cypress-plugin-grep-boxes 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/.prettierrc +5 -0
  2. package/index.js +10 -6
  3. package/package.json +1 -1
package/.prettierrc ADDED
@@ -0,0 +1,5 @@
1
+ {
2
+ "trailingComma": "es5",
3
+ "semi": true,
4
+ "singleQuote": true
5
+ }
package/index.js CHANGED
@@ -306,13 +306,17 @@ if (
306
306
  // if the grep test toggle is checked, do not show checkboxes on each runnable
307
307
  window.top?.document.querySelectorAll('#grepTestToggle:checked').length === 0
308
308
  ) {
309
- window.top?.document.addEventListener('click', () => {
310
- addGrepButtons();
311
- });
312
- window.top?.document.addEventListener('dblclick', () => {
309
+ // watching for changes to DOM structure
310
+ MutationObserver = window.MutationObserver;
311
+
312
+ var observer = new MutationObserver(function () {
313
+ // fired when a mutation occurs
313
314
  addGrepButtons();
314
315
  });
315
- window.top?.document.addEventListener('keypress', () => {
316
- addGrepButtons();
316
+
317
+ // defining the window.top?.document to be observed by the observer
318
+ observer.observe(window.top?.document, {
319
+ subtree: true,
320
+ attributes: true,
317
321
  });
318
322
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-grep-boxes",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Cypress plugin that allows user to run specific tests in open mode.",
5
5
  "main": "./index.js",
6
6
  "keywords": [