Prerequisite environment: Node.js 16 or later, yarn 1.22
Tools to deploy for unit testing: mocha, chai, jsdom
Applying this patch and running yarn install will install the necessary tools for testing.
As a first example of adding tests, I added tests to context_menu.js and refactored them.
- ES modules do not use global namespaces by default. There is no longer a need to fear duplicate function names; context_menu.js prefixed all functions "ContextMenu" to avoid function names conflict, but that practice is no longer necessary.
- Modularizing the scripts will delay processing, waiting until the HTML document is fully ready, which should speed up HTML processing as we move forward.
This patch also contains fix #37481.
The patch can be applied to r21737