cypress-plugin-grep-boxes 1.0.2 → 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 -3
  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,10 +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', () => {
309
+ // watching for changes to DOM structure
310
+ MutationObserver = window.MutationObserver;
311
+
312
+ var observer = new MutationObserver(function () {
313
+ // fired when a mutation occurs
310
314
  addGrepButtons();
311
315
  });
312
- window.top?.document.addEventListener('keypress', () => {
313
- 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,
314
321
  });
315
322
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cypress-plugin-grep-boxes",
3
- "version": "1.0.2",
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": [