@wordpress/e2e-tests 7.9.0 → 7.11.0

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 (45) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/jest.config.js +1 -4
  3. package/package.json +7 -7
  4. package/plugins/iframed-enqueue-block-editor-settings.php +19 -0
  5. package/plugins/interactive-blocks/{directive-show → directive-body}/block.json +3 -3
  6. package/plugins/interactive-blocks/directive-body/render.php +22 -0
  7. package/plugins/interactive-blocks/directive-body/view.js +11 -0
  8. package/plugins/interactive-blocks/directive-class/render.php +11 -0
  9. package/plugins/interactive-blocks/directive-effect/render.php +13 -1
  10. package/plugins/interactive-blocks/directive-effect/view.js +14 -16
  11. package/plugins/interactive-blocks/directive-init/block.json +14 -0
  12. package/plugins/interactive-blocks/directive-init/render.php +42 -0
  13. package/plugins/interactive-blocks/directive-init/view.js +64 -0
  14. package/plugins/interactive-blocks/directive-on/block.json +14 -0
  15. package/plugins/interactive-blocks/directive-on/render.php +52 -0
  16. package/plugins/interactive-blocks/directive-on/view.js +27 -0
  17. package/plugins/interactive-blocks/directive-priorities/render.php +4 -0
  18. package/plugins/interactive-blocks/store-afterload/block.json +14 -0
  19. package/plugins/interactive-blocks/store-afterload/render.php +41 -0
  20. package/plugins/interactive-blocks/store-afterload/view.js +60 -0
  21. package/plugins/interactive-blocks/tovdom-islands/render.php +5 -5
  22. package/plugins/interactive-blocks/tovdom-islands/view.js +18 -1
  23. package/specs/editor/plugins/iframed-enqueue-block-editor-settings.test.js +108 -0
  24. package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +2 -2
  25. package/specs/editor/various/__snapshots__/rich-text.test.js.snap +15 -1
  26. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +3 -3
  27. package/specs/editor/various/reusable-blocks.test.js +10 -7
  28. package/specs/editor/various/rich-text.test.js +11 -0
  29. package/specs/experiments/blocks/post-comments-form.test.js +2 -2
  30. package/specs/site-editor/settings-sidebar.test.js +1 -1
  31. package/assets/large-post.html +0 -5553
  32. package/assets/small-post-with-containers.html +0 -77
  33. package/config/performance-reporter.js +0 -177
  34. package/config/setup-performance-test.js +0 -51
  35. package/jest.performance.config.js +0 -16
  36. package/plugins/interactive-blocks/directive-show/render.php +0 -53
  37. package/plugins/interactive-blocks/directive-show/view.js +0 -24
  38. package/specs/editor/plugins/allowed-blocks.test.js +0 -59
  39. package/specs/editor/plugins/block-variations.test.js +0 -191
  40. package/specs/editor/plugins/iframed-equeue-block-assets.test.js +0 -51
  41. package/specs/performance/front-end-block-theme.test.js +0 -77
  42. package/specs/performance/front-end-classic-theme.test.js +0 -77
  43. package/specs/performance/post-editor.test.js +0 -369
  44. package/specs/performance/site-editor.test.js +0 -188
  45. package/specs/performance/utils.js +0 -146
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.11.0 (2023-08-16)
6
+
7
+ ## 7.10.0 (2023-08-10)
8
+
5
9
  ## 7.9.0 (2023-07-20)
6
10
 
7
11
  ## 7.8.0 (2023-07-05)
package/jest.config.js CHANGED
@@ -14,10 +14,7 @@ module.exports = {
14
14
  'expect-puppeteer',
15
15
  'puppeteer-testing-library/extend-expect',
16
16
  ],
17
- testPathIgnorePatterns: [
18
- '/node_modules/',
19
- 'e2e-tests/specs/performance/',
20
- ],
17
+ testPathIgnorePatterns: [ '/node_modules/' ],
21
18
  snapshotFormat: {
22
19
  escapeString: false,
23
20
  printBasicPrototype: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "7.9.0",
3
+ "version": "7.11.0",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -23,11 +23,11 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^10.9.0",
27
- "@wordpress/jest-console": "^7.9.0",
28
- "@wordpress/jest-puppeteer-axe": "^6.9.0",
29
- "@wordpress/scripts": "^26.9.0",
30
- "@wordpress/url": "^3.39.0",
26
+ "@wordpress/e2e-test-utils": "^10.11.0",
27
+ "@wordpress/jest-console": "^7.11.0",
28
+ "@wordpress/jest-puppeteer-axe": "^6.11.0",
29
+ "@wordpress/scripts": "^26.11.0",
30
+ "@wordpress/url": "^3.41.0",
31
31
  "chalk": "^4.0.0",
32
32
  "expect-puppeteer": "^4.4.0",
33
33
  "filenamify": "^4.2.0",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "6f14d11ed4cb59df110a28ebaa23ecba95eb673a"
48
+ "gitHead": "78a288d55b83a713b2f7d98d5a855c0771a2afc6"
49
49
  }
@@ -0,0 +1,19 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Iframed enqueue block editor settings
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-iframed-iframed-enqueue-block-editor-settings
8
+ */
9
+
10
+ add_action(
11
+ 'block_editor_settings_all',
12
+ function( $settings ) {
13
+ $settings['styles'][] = array(
14
+ 'css' => 'p { border: 1px solid red }',
15
+ '__unstableType' => 'plugin',
16
+ );
17
+ return $settings;
18
+ }
19
+ );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "apiVersion": 2,
3
- "name": "test/directive-show",
4
- "title": "E2E Interactivity tests - directive show",
3
+ "name": "test/directive-body",
4
+ "title": "E2E Interactivity tests - directive body",
5
5
  "category": "text",
6
6
  "icon": "heart",
7
7
  "description": "",
@@ -9,6 +9,6 @@
9
9
  "interactivity": true
10
10
  },
11
11
  "textdomain": "e2e-interactivity",
12
- "viewScript": "directive-show-view",
12
+ "viewScript": "directive-body-view",
13
13
  "render": "file:./render.php"
14
14
  }
@@ -0,0 +1,22 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the directive `data-wp-body`.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div
10
+ data-wp-interactive
11
+ data-wp-context='{"text":"text-1"}'
12
+ >
13
+ <div data-testid="container">
14
+ <aside data-wp-body data-testid="element with data-wp-body">
15
+ <p data-wp-text="context.text" data-testid="text">initial</p>
16
+ </aside>
17
+ </div>
18
+ <button
19
+ data-wp-on--click="actions.toggleText"
20
+ data-testid="toggle text"
21
+ >toggle text</button>
22
+ </div>
@@ -0,0 +1,11 @@
1
+ ( ( { wp } ) => {
2
+ const { store } = wp.interactivity;
3
+
4
+ store( {
5
+ actions: {
6
+ toggleText: ( { context } ) => {
7
+ context.text = context.text === 'text-1' ? 'text-2' : 'text-1';
8
+ },
9
+ },
10
+ } );
11
+ } )( window );
@@ -72,4 +72,15 @@
72
72
  Toggle context falseValue
73
73
  </button>
74
74
  </div>
75
+
76
+ <div
77
+ data-wp-class--block__element--modifier="state.trueValue"
78
+ data-testid="can use BEM notation classes"
79
+ ></div>
80
+
81
+ <div
82
+ data-wp-class--main-bg----color="state.trueValue"
83
+ data-testid="can use classes with several dashes"
84
+ ></div>
85
+
75
86
  </div>
@@ -7,7 +7,7 @@
7
7
 
8
8
  ?>
9
9
  <div data-wp-interactive>
10
- <div data-wp-fakeshow="state.isOpen">
10
+ <div data-wp-show-mock="state.isOpen">
11
11
  <input
12
12
  data-testid="input"
13
13
  data-wp-effect="effects.elementAddedToTheDOM"
@@ -21,7 +21,19 @@
21
21
 
22
22
  <div data-wp-effect="effects.changeFocus"></div>
23
23
 
24
+ <div
25
+ data-testid="short-circuit infinite loops"
26
+ data-wp-effect="effects.infiniteLoop"
27
+ data-wp-text="state.counter"
28
+ >
29
+ 0
30
+ </div>
31
+
24
32
  <button data-testid="toggle" data-wp-on--click="actions.toggle">
25
33
  Update
26
34
  </button>
35
+
36
+ <button data-testid="increment" data-wp-on--click="actions.increment">
37
+ Increment
38
+ </button>
27
39
  </div>
@@ -1,28 +1,19 @@
1
1
  ( ( { wp } ) => {
2
- const { store, directive, useContext, useMemo } = wp.interactivity;
2
+ const { store, directive } = wp.interactivity;
3
3
 
4
- // Fake `data-wp-fakeshow` directive to test when things are removed from the DOM.
5
- // Replace with `data-wp-show` when it's ready.
4
+ // Fake `data-wp-show-mock` directive to test when things are removed from the
5
+ // DOM. Replace with `data-wp-show` when it's ready.
6
6
  directive(
7
- 'fakeshow',
7
+ 'show-mock',
8
8
  ( {
9
9
  directives: {
10
- fakeshow: { default: fakeshow },
10
+ "show-mock": { default: showMock },
11
11
  },
12
12
  element,
13
13
  evaluate,
14
- context,
15
14
  } ) => {
16
- const contextValue = useContext( context );
17
- const children = useMemo(
18
- () =>
19
- element.type === 'template'
20
- ? element.props.templateChildren
21
- : element,
22
- []
23
- );
24
- if ( ! evaluate( fakeshow, { context: contextValue } ) ) return null;
25
- return children;
15
+ if ( ! evaluate( showMock ) ) return null;
16
+ return element;
26
17
  }
27
18
  );
28
19
 
@@ -30,6 +21,7 @@
30
21
  state: {
31
22
  isOpen: true,
32
23
  isElementInTheDOM: false,
24
+ counter: 0,
33
25
  },
34
26
  selectors: {
35
27
  elementInTheDOM: ( { state } ) =>
@@ -41,6 +33,9 @@
41
33
  toggle( { state } ) {
42
34
  state.isOpen = ! state.isOpen;
43
35
  },
36
+ increment( { state } ) {
37
+ state.counter = state.counter + 1;
38
+ },
44
39
  },
45
40
  effects: {
46
41
  elementAddedToTheDOM: ( { state } ) => {
@@ -55,6 +50,9 @@
55
50
  document.querySelector( "[data-testid='input']" ).focus();
56
51
  }
57
52
  },
53
+ infiniteLoop: ({ state }) => {
54
+ state.counter = state.counter + 1;
55
+ }
58
56
  },
59
57
  } );
60
58
 
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "name": "test/directive-init",
4
+ "title": "E2E Interactivity tests - directive init",
5
+ "category": "text",
6
+ "icon": "heart",
7
+ "description": "",
8
+ "supports": {
9
+ "interactivity": true
10
+ },
11
+ "textdomain": "e2e-interactivity",
12
+ "viewScript": "directive-init-view",
13
+ "render": "file:./render.php"
14
+ }
@@ -0,0 +1,42 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the directive `data-wp-init`.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div data-wp-interactive>
10
+ <div
11
+ data-testid="single init"
12
+ data-wp-context='{"isReady":[false],"calls":[0]}'
13
+ data-wp-init="actions.initOne"
14
+ >
15
+ <p data-wp-text="selector.isReady" data-testid="isReady">false</p>
16
+ <p data-wp-text="selector.calls" data-testid="calls">0</p>
17
+ <button data-wp-on--click="actions.reset">reset</button>
18
+ </div>
19
+ <div
20
+ data-testid="multiple inits"
21
+ data-wp-context='{"isReady":[false,false],"calls":[0,0]}'
22
+ data-wp-init--one="actions.initOne"
23
+ data-wp-init--two="actions.initTwo"
24
+ >
25
+ <p data-wp-text="selector.isReady" data-testid="isReady">false,false</p>
26
+ <p data-wp-text="selector.calls" data-testid="calls">0,0</p>
27
+ </div>
28
+ <div
29
+ data-testid="init show"
30
+ data-wp-context='{"isVisible":true,"isMounted":false}'
31
+ >
32
+ <div data-wp-show-mock="context.isVisible" data-testid="show">
33
+ <span data-wp-init="actions.initMount">Initially visible</span>
34
+ </div>
35
+ <button data-wp-on--click="actions.toggle" data-testid="toggle">
36
+ toggle
37
+ </button>
38
+ <p data-wp-text="selector.isMounted" data-testid="isMounted">
39
+ true
40
+ </p>
41
+ </div>
42
+ </div>
@@ -0,0 +1,64 @@
1
+ ( ( { wp } ) => {
2
+ const { store, directive, useContext } = wp.interactivity;
3
+
4
+ // Mock `data-wp-show` directive to test when things are removed from the
5
+ // DOM. Replace with `data-wp-show` when it's ready.
6
+ directive(
7
+ 'show-mock',
8
+ ( {
9
+ directives: {
10
+ 'show-mock': { default: showMock },
11
+ },
12
+ element,
13
+ evaluate,
14
+ context,
15
+ } ) => {
16
+ const contextValue = useContext( context );
17
+ if ( ! evaluate( showMock, { context: contextValue } ) ) {
18
+ return null;
19
+ }
20
+ return element;
21
+ }
22
+ );
23
+
24
+
25
+ store( {
26
+ selector: {
27
+ isReady: ({ context: { isReady } }) => {
28
+ return isReady
29
+ .map(v => v ? 'true': 'false')
30
+ .join(',');
31
+ },
32
+ calls: ({ context: { calls } }) => {
33
+ return calls.join(',');
34
+ },
35
+ isMounted: ({ context }) => {
36
+ return context.isMounted ? 'true' : 'false';
37
+ },
38
+ },
39
+ actions: {
40
+ initOne: ( { context: { isReady, calls } } ) => {
41
+ isReady[0] = true;
42
+ // Subscribe to changes in that prop.
43
+ isReady[0] = isReady[0];
44
+ calls[0]++;
45
+ },
46
+ initTwo: ( { context: { isReady, calls } } ) => {
47
+ isReady[1] = true;
48
+ calls[1]++;
49
+ },
50
+ initMount: ( { context } ) => {
51
+ context.isMounted = true;
52
+ return () => {
53
+ context.isMounted = false;
54
+ }
55
+ },
56
+ reset: ( { context: { isReady } } ) => {
57
+ isReady.fill(false);
58
+ },
59
+ toggle: ( { context } ) => {
60
+ context.isVisible = ! context.isVisible;
61
+ },
62
+ },
63
+ } );
64
+ } )( window );
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "name": "test/directive-on",
4
+ "title": "E2E Interactivity tests - directive on",
5
+ "category": "text",
6
+ "icon": "heart",
7
+ "description": "",
8
+ "supports": {
9
+ "interactivity": true
10
+ },
11
+ "textdomain": "e2e-interactivity",
12
+ "viewScript": "directive-on-view",
13
+ "render": "file:./render.php"
14
+ }
@@ -0,0 +1,52 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the directive `data-wp-on`.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div data-wp-interactive>
10
+ <div>
11
+ <p data-wp-text="state.counter" data-testid="counter">0</p>
12
+ <button
13
+ data-testid="button"
14
+ data-wp-on--click="actions.clickHandler"
15
+ >Click me!</button>
16
+ </div>
17
+ <div>
18
+ <p data-wp-text="state.text" data-testid="text">initial</p>
19
+ <input
20
+ type="text"
21
+ value="initial"
22
+ data-testid="input"
23
+ data-wp-on--input="actions.inputHandler"
24
+ >
25
+ </div>
26
+ <div data-wp-context='{"option":"undefined"}'>
27
+ <p data-wp-text="context.option" data-testid="option">0</p>
28
+ <select
29
+ name="pets"
30
+ value="undefined"
31
+ data-testid="select"
32
+ data-wp-on--change="actions.selectHandler"
33
+ >
34
+ <option value="undefined">Choose an option...</option>
35
+ <option value="dog">Dog</option>
36
+ <option value="cat">Cat</option>
37
+ </select>
38
+ </div>
39
+ <div
40
+ data-wp-on--customevent="actions.customEventHandler"
41
+ data-wp-context='{"customEvents":0}'
42
+ >
43
+ <p
44
+ data-wp-text="context.customEvents"
45
+ data-testid="custom events counter"
46
+ >0</p>
47
+ <button
48
+ data-testid="custom events button"
49
+ data-wp-on--click="actions.clickHandler"
50
+ >Click me!</button>
51
+ </div>
52
+ </div>
@@ -0,0 +1,27 @@
1
+ ( ( { wp } ) => {
2
+ const { store } = wp.interactivity;
3
+
4
+ store( {
5
+ state: {
6
+ counter: 0,
7
+ text: ''
8
+ },
9
+ actions: {
10
+ clickHandler: ( { state, event } ) => {
11
+ state.counter += 1;
12
+ event.target.dispatchEvent(
13
+ new CustomEvent( 'customevent', { bubbles: true } )
14
+ );
15
+ },
16
+ inputHandler: ( { state, event } ) => {
17
+ state.text = event.target.value;
18
+ },
19
+ selectHandler: ( { context, event } ) => {
20
+ context.option = event.target.value;
21
+ },
22
+ customEventHandler: ({ context }) => {
23
+ context.customEvents += 1;
24
+ },
25
+ },
26
+ } );
27
+ } )( window );
@@ -18,3 +18,7 @@
18
18
  data-wp-test-context
19
19
  ></div>
20
20
  </div>
21
+
22
+ <div data-testid="non-existent-directives">
23
+ <div data-wp-interactive ><div data-wp-non-existent-directive></div></div>
24
+ </div>
@@ -0,0 +1,14 @@
1
+ {
2
+ "apiVersion": 2,
3
+ "name": "test/store-afterload",
4
+ "title": "E2E Interactivity tests - store afterload",
5
+ "category": "text",
6
+ "icon": "heart",
7
+ "description": "",
8
+ "supports": {
9
+ "interactivity": true
10
+ },
11
+ "textdomain": "e2e-interactivity",
12
+ "viewScript": "store-afterload-view",
13
+ "render": "file:./render.php"
14
+ }
@@ -0,0 +1,41 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing `afterLoad` callbacks added to the store.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+
8
+ ?>
9
+ <div data-wp-interactive>
10
+ <h3>Store statuses</h3>
11
+ <p data-store-status data-wp-text="state.status1">waiting</p>
12
+ <p data-store-status data-wp-text="state.status2">waiting</p>
13
+ <p data-store-status data-wp-text="state.status3">waiting</p>
14
+ <p data-store-status data-wp-text="state.status4">waiting</p>
15
+
16
+ <h3><code>afterLoad</code> executions</h3>
17
+ <p>All stores ready:&#20;
18
+ <span
19
+ data-testid="all-stores-ready"
20
+ data-wp-text="state.allStoresReady">
21
+ >waiting</span>
22
+ </p>
23
+ <p>vDOM ready:&#20;
24
+ <span
25
+ data-testid="vdom-ready"
26
+ data-wp-text="state.vdomReady">
27
+ >waiting</span>
28
+ </p>
29
+ <p><code>afterLoad</code> exec times:&#20;
30
+ <span
31
+ data-testid="after-load-exec-times"
32
+ data-wp-text="state.execTimes.afterLoad">
33
+ >0</span>
34
+ </p>
35
+ <p><code>sharedAfterLoad</code> exec times:&#20;
36
+ <span
37
+ data-testid="shared-after-load-exec-times"
38
+ data-wp-text="state.execTimes.sharedAfterLoad">
39
+ >0</span>
40
+ </p>
41
+ </div>
@@ -0,0 +1,60 @@
1
+ ( ( { wp } ) => {
2
+ /**
3
+ * WordPress dependencies
4
+ */
5
+ const { store } = wp.interactivity;
6
+
7
+ const afterLoad = ({ state }) => {
8
+ // Check the state is correctly initialized.
9
+ const { status1, status2, status3, status4 } = state;
10
+ state.allStoresReady =
11
+ [ status1, status2, status3, status4 ]
12
+ .every( ( t ) => t === 'ready' )
13
+ .toString();
14
+
15
+ // Check the HTML has been processed as well.
16
+ const selector = '[data-store-status]';
17
+ state.vdomReady =
18
+ document.querySelector( selector ) &&
19
+ Array.from(
20
+ document.querySelectorAll( selector )
21
+ ).every( ( el ) => el.textContent === 'ready' ).toString();
22
+
23
+ // Increment exec times everytime this function runs.
24
+ state.execTimes.afterLoad += 1;
25
+ }
26
+
27
+ const sharedAfterLoad = ({ state }) => {
28
+ // Increment exec times everytime this function runs.
29
+ state.execTimes.sharedAfterLoad += 1;
30
+ }
31
+
32
+ // Case 1: without afterload callback
33
+ store( {
34
+ state: { status1: 'ready' },
35
+ } );
36
+
37
+ // Case 2: non-shared afterload callback
38
+ store( {
39
+ state: {
40
+ status2: 'ready',
41
+ allStoresReady: false,
42
+ vdomReady: false,
43
+ execTimes: { afterLoad: 0 },
44
+ },
45
+ }, { afterLoad } );
46
+
47
+ // Case 3: shared afterload callback
48
+ store( {
49
+ state: {
50
+ status3: 'ready',
51
+ execTimes: { sharedAfterLoad: 0 },
52
+ },
53
+ }, { afterLoad: sharedAfterLoad } );
54
+ store( {
55
+ state: {
56
+ status4: 'ready',
57
+ execTimes: { sharedAfterLoad: 0 },
58
+ },
59
+ }, { afterLoad: sharedAfterLoad } );
60
+ } )( window );
@@ -7,14 +7,14 @@
7
7
 
8
8
  ?>
9
9
  <div>
10
- <div data-wp-show="state.falseValue">
10
+ <div data-wp-show-mock="state.falseValue">
11
11
  <span data-testid="not inside an island">
12
12
  This should be shown because it is inside an island.
13
13
  </span>
14
14
  </div>
15
15
 
16
16
  <div data-wp-interactive>
17
- <div data-wp-show="state.falseValue">
17
+ <div data-wp-show-mock="state.falseValue">
18
18
  <span data-testid="inside an island">
19
19
  This should not be shown because it is inside an island.
20
20
  </span>
@@ -23,7 +23,7 @@
23
23
 
24
24
  <div data-wp-interactive>
25
25
  <div data-wp-ignore>
26
- <div data-wp-show="state.falseValue">
26
+ <div data-wp-show-mock="state.falseValue">
27
27
  <span
28
28
  data-testid="inside an inner block of an isolated island"
29
29
  >
@@ -37,7 +37,7 @@
37
37
  <div data-wp-interactive>
38
38
  <div data-wp-interactive>
39
39
  <div
40
- data-wp-show="state.falseValue"
40
+ data-wp-show-mock="state.falseValue"
41
41
  data-testid="island inside another island"
42
42
  >
43
43
  <span>
@@ -51,7 +51,7 @@
51
51
  <div data-wp-interactive>
52
52
  <div>
53
53
  <div data-wp-interactive data-wp-ignore>
54
- <div data-wp-show="state.falseValue">
54
+ <div data-wp-show-mock="state.falseValue">
55
55
  <span
56
56
  data-testid="island inside inner block of isolated island"
57
57
  >
@@ -1,5 +1,22 @@
1
1
  ( ( { wp } ) => {
2
- const { store } = wp.interactivity;
2
+ const { store, directive, createElement } = wp.interactivity;
3
+
4
+ // Fake `data-wp-show-mock` directive to test when things are removed from the
5
+ // DOM. Replace with `data-wp-show` when it's ready.
6
+ directive(
7
+ 'show-mock',
8
+ ( {
9
+ directives: {
10
+ "show-mock": { default: showMock },
11
+ },
12
+ element,
13
+ evaluate,
14
+ } ) => {
15
+ if ( ! evaluate( showMock ) )
16
+ element.props.children =
17
+ createElement( "template", null, element.props.children );
18
+ }
19
+ );
3
20
 
4
21
  store( {
5
22
  state: {