@wordpress/e2e-tests 8.24.0 → 8.26.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 (55) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/package.json +9 -9
  3. package/plugins/interactive-blocks/generator-scope/render.php +3 -0
  4. package/plugins/interactive-blocks/generator-scope/view.js +31 -1
  5. package/plugins/interactive-blocks/router-regions/render.php +115 -8
  6. package/plugins/interactive-blocks/router-regions/view.js +21 -1
  7. package/plugins/interactive-blocks/router-script-modules-alpha/block.json +15 -0
  8. package/plugins/interactive-blocks/router-script-modules-alpha/module-alpha-1.js +1 -0
  9. package/plugins/interactive-blocks/router-script-modules-alpha/module-alpha-2.js +1 -0
  10. package/plugins/interactive-blocks/router-script-modules-alpha/render.php +35 -0
  11. package/plugins/interactive-blocks/router-script-modules-alpha/view.asset.php +15 -0
  12. package/plugins/interactive-blocks/router-script-modules-alpha/view.js +43 -0
  13. package/plugins/interactive-blocks/router-script-modules-bravo/block.json +15 -0
  14. package/plugins/interactive-blocks/router-script-modules-bravo/module-bravo-1.js +1 -0
  15. package/plugins/interactive-blocks/router-script-modules-bravo/module-bravo-2.js +1 -0
  16. package/plugins/interactive-blocks/router-script-modules-bravo/render.php +35 -0
  17. package/plugins/interactive-blocks/router-script-modules-bravo/view.asset.php +15 -0
  18. package/plugins/interactive-blocks/router-script-modules-bravo/view.js +43 -0
  19. package/plugins/interactive-blocks/router-script-modules-charlie/block.json +15 -0
  20. package/plugins/interactive-blocks/router-script-modules-charlie/module-charlie-1.js +1 -0
  21. package/plugins/interactive-blocks/router-script-modules-charlie/module-charlie-2.js +1 -0
  22. package/plugins/interactive-blocks/router-script-modules-charlie/render.php +35 -0
  23. package/plugins/interactive-blocks/router-script-modules-charlie/view.asset.php +15 -0
  24. package/plugins/interactive-blocks/router-script-modules-charlie/view.js +43 -0
  25. package/plugins/interactive-blocks/router-script-modules-wrapper/block.json +15 -0
  26. package/plugins/interactive-blocks/router-script-modules-wrapper/module-initial-1.js +1 -0
  27. package/plugins/interactive-blocks/router-script-modules-wrapper/module-initial-2.js +1 -0
  28. package/plugins/interactive-blocks/router-script-modules-wrapper/render.php +60 -0
  29. package/plugins/interactive-blocks/router-script-modules-wrapper/view.asset.php +14 -0
  30. package/plugins/interactive-blocks/router-script-modules-wrapper/view.js +32 -0
  31. package/plugins/interactive-blocks/router-styles-blue/assets/10x10_e2e_test_image_blue.png +0 -0
  32. package/plugins/interactive-blocks/router-styles-blue/block.json +15 -0
  33. package/plugins/interactive-blocks/router-styles-blue/render.php +35 -0
  34. package/plugins/interactive-blocks/router-styles-blue/style-from-link.css +7 -0
  35. package/plugins/interactive-blocks/router-styles-blue/style.css +4 -0
  36. package/plugins/interactive-blocks/router-styles-green/assets/10x10_e2e_test_image_green.png +0 -0
  37. package/plugins/interactive-blocks/router-styles-green/block.json +15 -0
  38. package/plugins/interactive-blocks/router-styles-green/render.php +35 -0
  39. package/plugins/interactive-blocks/router-styles-green/style-from-link.css +7 -0
  40. package/plugins/interactive-blocks/router-styles-green/style.css +4 -0
  41. package/plugins/interactive-blocks/router-styles-red/assets/10x10_e2e_test_image_red.png +0 -0
  42. package/plugins/interactive-blocks/router-styles-red/block.json +15 -0
  43. package/plugins/interactive-blocks/router-styles-red/render.php +35 -0
  44. package/plugins/interactive-blocks/router-styles-red/style-from-link.css +7 -0
  45. package/plugins/interactive-blocks/router-styles-red/style.css +4 -0
  46. package/plugins/interactive-blocks/router-styles-wrapper/block.json +16 -0
  47. package/plugins/interactive-blocks/router-styles-wrapper/render.php +94 -0
  48. package/plugins/interactive-blocks/router-styles-wrapper/style-from-link.css +7 -0
  49. package/plugins/interactive-blocks/router-styles-wrapper/style.css +3 -0
  50. package/plugins/interactive-blocks/router-styles-wrapper/view.asset.php +9 -0
  51. package/plugins/interactive-blocks/router-styles-wrapper/view.js +31 -0
  52. package/plugins/interactive-blocks/store-tag/render.php +1 -1
  53. package/plugins/interactive-blocks/tovdom/processing-instructions.js +1 -0
  54. package/plugins/interactive-blocks/tovdom/render.php +1 -0
  55. package/plugins/interactive-blocks.php +4 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 8.26.0 (2025-06-25)
6
+
7
+ ## 8.25.0 (2025-06-04)
8
+
5
9
  ## 8.24.0 (2025-05-22)
6
10
 
7
11
  ## 8.23.0 (2025-05-07)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "8.24.0",
3
+ "version": "8.26.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",
@@ -24,13 +24,13 @@
24
24
  "npm": ">=8.19.2"
25
25
  },
26
26
  "dependencies": {
27
- "@wordpress/e2e-test-utils": "^11.24.0",
28
- "@wordpress/interactivity": "^6.24.0",
29
- "@wordpress/interactivity-router": "^2.24.0",
30
- "@wordpress/jest-console": "^8.24.0",
31
- "@wordpress/jest-puppeteer-axe": "^7.24.0",
32
- "@wordpress/scripts": "^30.17.0",
33
- "@wordpress/url": "^4.24.0",
27
+ "@wordpress/e2e-test-utils": "^11.26.0",
28
+ "@wordpress/interactivity": "^6.26.0",
29
+ "@wordpress/interactivity-router": "^2.26.0",
30
+ "@wordpress/jest-console": "^8.26.0",
31
+ "@wordpress/jest-puppeteer-axe": "^7.26.0",
32
+ "@wordpress/scripts": "^30.19.0",
33
+ "@wordpress/url": "^4.26.0",
34
34
  "chalk": "^4.0.0",
35
35
  "expect-puppeteer": "^4.4.0",
36
36
  "filenamify": "^4.2.0",
@@ -47,5 +47,5 @@
47
47
  "publishConfig": {
48
48
  "access": "public"
49
49
  },
50
- "gitHead": "9c03d1458cae76792ae15e67b421205836bf4393"
50
+ "gitHead": "35e26942820d8237771af0c58e45b4303f0497f1"
51
51
  }
@@ -13,4 +13,7 @@
13
13
  <input readonly data-wp-bind--value="context.result" data-testid="result" />
14
14
  <button type="button" data-wp-on--click="callbacks.resolve" data-testid="resolve">Async resolve</button>
15
15
  <button type="button" data-wp-on--click="callbacks.reject" data-testid="reject">Async reject</button>
16
+ <button type="button" data-wp-on--click="callbacks.capture" data-testid="capture">Async capture</button>
17
+ <button type="button" data-wp-on--click="callbacks.captureThrow" data-testid="captureThrow">Async captureThrow</button>
18
+ <button type="button" data-wp-on--click="callbacks.captureReturnReject" data-testid="captureReturnReject">Async captureReturnReject</button>
16
19
  </div>
@@ -3,7 +3,7 @@
3
3
  */
4
4
  import { store, getContext } from '@wordpress/interactivity';
5
5
 
6
- store( 'test/generator-scope', {
6
+ const { callbacks } = store( 'test/generator-scope', {
7
7
  callbacks: {
8
8
  *resolve() {
9
9
  try {
@@ -19,5 +19,35 @@ store( 'test/generator-scope', {
19
19
  getContext().result = err.toString();
20
20
  }
21
21
  },
22
+ *capture() {
23
+ let value = yield Promise.resolve( 1 );
24
+ try {
25
+ value = yield Promise.reject( 2 );
26
+ } catch ( e ) {
27
+ value = yield Promise.resolve( 3 );
28
+ }
29
+ getContext().result = value;
30
+ },
31
+ *throw() {
32
+ const value = yield Promise.resolve( '🤯' );
33
+ throw new Error( value );
34
+ },
35
+ *captureThrow() {
36
+ try {
37
+ yield callbacks.throw();
38
+ } catch ( err ) {
39
+ getContext().result = err.toString();
40
+ }
41
+ },
42
+ *returnReject() {
43
+ return Promise.reject( new Error( '🔚' ) );
44
+ },
45
+ *captureReturnReject() {
46
+ try {
47
+ yield callbacks.returnReject();
48
+ } catch ( err ) {
49
+ getContext().result = err.toString();
50
+ }
51
+ },
22
52
  },
23
53
  } );
@@ -11,7 +11,7 @@
11
11
  <section>
12
12
  <h2>Region 1</h2>
13
13
  <div
14
- data-wp-interactive='{"namespace": "router-regions"}'
14
+ data-wp-interactive="router-regions"
15
15
  data-wp-router-region="region-1"
16
16
  >
17
17
  <p
@@ -51,11 +51,10 @@
51
51
  >not hydrated</p>
52
52
  </div>
53
53
 
54
-
55
54
  <section>
56
55
  <h2>Region 2</h2>
57
56
  <div
58
- data-wp-interactive='{"namespace": "router-regions"}'
57
+ data-wp-interactive="router-regions"
59
58
  data-wp-router-region="region-2"
60
59
  >
61
60
  <p
@@ -74,7 +73,7 @@
74
73
  data-wp-on--click="actions.counter.increment"
75
74
  >NaN</button>
76
75
 
77
- <div data-wp-ignore>
76
+ <div>
78
77
  <div>
79
78
  <p
80
79
  data-testid="no-region-text-2"
@@ -85,14 +84,122 @@
85
84
  <section>
86
85
  <h2>Nested region</h2>
87
86
  <div
88
- data-wp-interactive='{"namespace": "router-regions"}'
87
+ data-wp-interactive="router-regions"
89
88
  data-wp-router-region="nested-region"
90
89
  >
91
- <p
92
- data-testid="nested-region-ssr"
93
- >content from page <?php echo $attributes['page']; ?></p>
90
+ <p data-testid="nested-region-ssr">
91
+ content from page <?php echo $attributes['page']; ?>
92
+ </p>
93
+
94
+ <button data-testid="add-item" data-wp-on--click="actions.addItem">
95
+ Add item
96
+ </button>
97
+
98
+ <ul>
99
+ <template data-wp-each="state.items">
100
+ <li data-testid="nested-item" data-wp-key="context.item" data-wp-text="context.item"></li>
101
+ </template>
102
+ <li data-testid="nested-item" data-wp-each-child>item 1</li>
103
+ <li data-testid="nested-item" data-wp-each-child>item 2</li>
104
+ <li data-testid="nested-item" data-wp-each-child>item 3</li>
105
+ </ul>
94
106
  </div>
95
107
  </section>
96
108
  </div>
97
109
  </div>
98
110
  </section>
111
+
112
+ <div data-wp-interactive="router-regions">
113
+ <div data-wp-router-region="invalid-region-1">
114
+ <p data-testid="invalid-region-text-1">
115
+ content from page <?php echo $attributes['page']; ?>
116
+ </p>
117
+ </div>
118
+ <div data-wp-interactive="router-regions" data-wp-router-region="invalid-region-2">
119
+ <p data-testid="invalid-region-text-2">
120
+ content from page <?php echo $attributes['page']; ?>
121
+ </p>
122
+ </div>
123
+ </div>
124
+
125
+ <div id="regions-with-attach-to" data-testid="regions-with-attach-to">
126
+ <?php
127
+ /*
128
+ * Set of router regions with the `attachTo` property specified,
129
+ * as defined in the `regionsWithAttachTo` attribute.
130
+ *
131
+ * Each object inside such an attribute have the following properties:
132
+ * - `type`: the type of the HTML element where the `data-wp-router-region` directive is defined, e.g. 'div'.
133
+ * - `data`: the data passed to the `data-wp-router-region` directive, i.e., `id` and `attachTo`.
134
+ * - `hasDirectives`: a boolean indicating that the top element of the router region have actual directives that
135
+ * make the element to be wrapped in a `Directives` component.
136
+ */
137
+ foreach ( $attributes['regionsWithAttachTo'] ?? array() as $region ) {
138
+ $region_type = esc_attr( $region['type'] );
139
+ $region_id = esc_attr( $region['data']['id'] );
140
+ $region_data = wp_json_encode( $region['data'] );
141
+ $has_directives = isset( $region['hasDirectives'] )
142
+ ? ' data-wp-init="callbacks.init"'
143
+ : '';
144
+ $context_data = wp_interactivity_data_wp_context(
145
+ array(
146
+ 'text' => $region['data']['id'],
147
+ 'counter' => array(
148
+ 'value' => $attributes['counter'] ?? 0,
149
+ 'serverValue' => $attributes['counter'] ?? 0,
150
+ ),
151
+ )
152
+ );
153
+
154
+ $html = <<<HTML
155
+ <$region_type
156
+ data-wp-interactive="router-regions"
157
+ data-wp-router-region='$region_data'
158
+ data-testid="$region_id"
159
+ $has_directives
160
+ >
161
+ <div $context_data>
162
+ <h2>Region with <code>attachTo</code></h2>
163
+ <p
164
+ data-testid="text"
165
+ data-wp-text="context.text"
166
+ >not hydrated</p>
167
+
168
+ <p> Client value:
169
+ <button
170
+ data-testid="client-counter"
171
+ data-wp-text="context.counter.value"
172
+ data-wp-on--click="actions.counter.increment"
173
+ >
174
+ NaN
175
+ </button>
176
+ </p>
177
+ <p> Server value:
178
+ <output
179
+ data-testid="server-counter"
180
+ data-wp-text="context.counter.serverValue"
181
+ data-wp-watch="actions.counter.updateCounterFromServer"
182
+ >
183
+ NaN
184
+ </output>
185
+ </p>
186
+ </div>
187
+ </$region_type>
188
+ HTML;
189
+
190
+ echo $html;
191
+ }
192
+ ?>
193
+ </div>
194
+
195
+ <!--
196
+ Count of times the `actions.init` function has been executed.
197
+ Used to verify that `data-wp-init` works on regions with `attachTo`.
198
+ -->
199
+ <div
200
+ data-wp-interactive="router-regions"
201
+ data-testid="init-count"
202
+ data-wp-text="state.initCount"
203
+ >
204
+ NaN
205
+ </div>
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { store, getContext, withSyncEvent } from '@wordpress/interactivity';
4
+ import {
5
+ store,
6
+ getContext,
7
+ getServerContext,
8
+ withSyncEvent,
9
+ } from '@wordpress/interactivity';
5
10
 
6
11
  const { state } = store( 'router-regions', {
7
12
  state: {
@@ -14,6 +19,8 @@ const { state } = store( 'router-regions', {
14
19
  counter: {
15
20
  value: 0,
16
21
  },
22
+ items: [ 'item 1', 'item 2', 'item 3' ],
23
+ initCount: 0,
17
24
  },
18
25
  actions: {
19
26
  router: {
@@ -43,6 +50,19 @@ const { state } = store( 'router-regions', {
43
50
  context.counter.value = context.counter.initialValue;
44
51
  }
45
52
  },
53
+ updateCounterFromServer() {
54
+ const context = getContext();
55
+ const serverContext = getServerContext();
56
+ context.counter.serverValue = serverContext.counter.serverValue;
57
+ },
58
+ },
59
+ addItem() {
60
+ state.items.push( `item ${ state.items.length + 1 }` );
61
+ },
62
+ },
63
+ callbacks: {
64
+ init() {
65
+ state.initCount += 1;
46
66
  },
47
67
  },
48
68
  } );
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-script-modules-alpha",
5
+ "title": "E2E Interactivity tests - router modules - Alpha",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewScriptModule": "file:./view.js",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1 @@
1
+ export default 'alpha-1';
@@ -0,0 +1 @@
1
+ export default 'alpha-2';
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's script module assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ $modules = array( 'alpha-1', 'alpha-2' );
11
+
12
+ foreach ( $modules as $module ) {
13
+ $module_path = '/module-' . $module . '.js';
14
+ wp_register_script_module(
15
+ 'test/router-script-modules-' . $module,
16
+ plugins_url( $module_path, __FILE__ ),
17
+ array(),
18
+ filemtime( plugin_dir_path( __FILE__ ) . $module_path )
19
+ );
20
+ }
21
+
22
+ $wrapper_attributes = get_block_wrapper_attributes(
23
+ array(
24
+ 'data-testid' => 'alpha-block',
25
+ 'data-wp-interactive' => 'test/router-script-modules-alpha',
26
+ )
27
+ );
28
+ ?>
29
+ <div <?php echo $wrapper_attributes; ?>>
30
+ <span data-testid="text" data-wp-text="state.name"></span>
31
+ <button data-testid="static" data-wp-on--click="actions.updateFromStatic">Static</button>
32
+ <button data-testid="dynamic" data-wp-on--click="actions.updateFromDynamic">Dynamic</button>
33
+ <button data-testid="initial-static" data-wp-on--click="actions.updateFromInitialStatic">Static (initial)</button>
34
+ <button data-testid="initial-dynamic" data-wp-on--click="actions.updateFromInitialDynamic">Dynamic (initial)</button>
35
+ </div>
@@ -0,0 +1,15 @@
1
+ <?php return array(
2
+ 'dependencies' => array(
3
+ '@wordpress/interactivity',
4
+ 'test/router-script-modules-alpha-1',
5
+ 'test/router-script-modules-initial-1',
6
+ array(
7
+ 'id' => 'test/router-script-modules-alpha-2',
8
+ 'import' => 'dynamic',
9
+ ),
10
+ array(
11
+ 'id' => 'test/router-script-modules-initial-2',
12
+ 'import' => 'dynamic',
13
+ ),
14
+ ),
15
+ );
@@ -0,0 +1,43 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store } from '@wordpress/interactivity';
5
+
6
+ /**
7
+ * External dependencies
8
+ */
9
+ // eslint-disable-next-line import/no-unresolved
10
+ import nameStatic from 'test/router-script-modules-alpha-1';
11
+ // eslint-disable-next-line import/no-unresolved
12
+ import nameInitialStatic from 'test/router-script-modules-initial-1';
13
+
14
+ const { state } = store( 'test/router-script-modules-alpha', {
15
+ state: {
16
+ name: 'alpha',
17
+ },
18
+ actions: {
19
+ updateFromStatic() {
20
+ state.name = nameStatic;
21
+ },
22
+ updateFromInitialStatic() {
23
+ state.name = nameInitialStatic;
24
+ },
25
+ *updateFromDynamic() {
26
+ const { default: nameDynamic } = yield import(
27
+ // eslint-disable-next-line import/no-unresolved
28
+ 'test/router-script-modules-alpha-2'
29
+ );
30
+ state.name = nameDynamic;
31
+ },
32
+ *updateFromInitialDynamic() {
33
+ const { default: nameInitialDynamic } = yield import(
34
+ // eslint-disable-next-line import/no-unresolved
35
+ 'test/router-script-modules-initial-2'
36
+ );
37
+ state.name = nameInitialDynamic;
38
+ },
39
+ },
40
+ } );
41
+
42
+ const { actions } = store( 'test/router-script-modules' );
43
+ actions.pushName?.( state.name );
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-script-modules-bravo",
5
+ "title": "E2E Interactivity tests - router modules - Bravo",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewScriptModule": "file:./view.js",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1 @@
1
+ export default 'bravo-1';
@@ -0,0 +1 @@
1
+ export default 'bravo-2';
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's script module assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ $modules = array( 'bravo-1', 'bravo-2' );
11
+
12
+ foreach ( $modules as $module ) {
13
+ $module_path = '/module-' . $module . '.js';
14
+ wp_register_script_module(
15
+ 'test/router-script-modules-' . $module,
16
+ plugins_url( $module_path, __FILE__ ),
17
+ array(),
18
+ filemtime( plugin_dir_path( __FILE__ ) . $module_path )
19
+ );
20
+ }
21
+
22
+ $wrapper_attributes = get_block_wrapper_attributes(
23
+ array(
24
+ 'data-testid' => 'bravo-block',
25
+ 'data-wp-interactive' => 'test/router-script-modules-bravo',
26
+ )
27
+ );
28
+ ?>
29
+ <div <?php echo $wrapper_attributes; ?>>
30
+ <span data-testid="text" data-wp-text="state.name"></span>
31
+ <button data-testid="static" data-wp-on--click="actions.updateFromStatic">Static</button>
32
+ <button data-testid="dynamic" data-wp-on--click="actions.updateFromDynamic">Dynamic</button>
33
+ <button data-testid="initial-static" data-wp-on--click="actions.updateFromInitialStatic">Static (initial)</button>
34
+ <button data-testid="initial-dynamic" data-wp-on--click="actions.updateFromInitialDynamic">Dynamic (initial)</button>
35
+ </div>
@@ -0,0 +1,15 @@
1
+ <?php return array(
2
+ 'dependencies' => array(
3
+ '@wordpress/interactivity',
4
+ 'test/router-script-modules-bravo-1',
5
+ 'test/router-script-modules-initial-1',
6
+ array(
7
+ 'id' => 'test/router-script-modules-bravo-2',
8
+ 'import' => 'dynamic',
9
+ ),
10
+ array(
11
+ 'id' => 'test/router-script-modules-initial-2',
12
+ 'import' => 'dynamic',
13
+ ),
14
+ ),
15
+ );
@@ -0,0 +1,43 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store } from '@wordpress/interactivity';
5
+
6
+ /**
7
+ * External dependencies
8
+ */
9
+ // eslint-disable-next-line import/no-unresolved
10
+ import nameStatic from 'test/router-script-modules-bravo-1';
11
+ // eslint-disable-next-line import/no-unresolved
12
+ import nameInitialStatic from 'test/router-script-modules-initial-1';
13
+
14
+ const { state } = store( 'test/router-script-modules-bravo', {
15
+ state: {
16
+ name: 'bravo',
17
+ },
18
+ actions: {
19
+ updateFromStatic() {
20
+ state.name = nameStatic;
21
+ },
22
+ updateFromInitialStatic() {
23
+ state.name = nameInitialStatic;
24
+ },
25
+ *updateFromDynamic() {
26
+ const { default: nameDynamic } = yield import(
27
+ // eslint-disable-next-line import/no-unresolved
28
+ 'test/router-script-modules-bravo-2'
29
+ );
30
+ state.name = nameDynamic;
31
+ },
32
+ *updateFromInitialDynamic() {
33
+ const { default: nameInitialDynamic } = yield import(
34
+ // eslint-disable-next-line import/no-unresolved
35
+ 'test/router-script-modules-initial-2'
36
+ );
37
+ state.name = nameInitialDynamic;
38
+ },
39
+ },
40
+ } );
41
+
42
+ const { actions } = store( 'test/router-script-modules' );
43
+ actions.pushName?.( state.name );
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-script-modules-charlie",
5
+ "title": "E2E Interactivity tests - router modules - Charlie",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewScriptModule": "file:./view.js",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1 @@
1
+ export default 'charlie-1';
@@ -0,0 +1 @@
1
+ export default 'charlie-2';
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's script module assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ $modules = array( 'charlie-1', 'charlie-2' );
11
+
12
+ foreach ( $modules as $module ) {
13
+ $module_path = '/module-' . $module . '.js';
14
+ wp_register_script_module(
15
+ 'test/router-script-modules-' . $module,
16
+ plugins_url( $module_path, __FILE__ ),
17
+ array(),
18
+ filemtime( plugin_dir_path( __FILE__ ) . $module_path )
19
+ );
20
+ }
21
+
22
+ $wrapper_attributes = get_block_wrapper_attributes(
23
+ array(
24
+ 'data-testid' => 'charlie-block',
25
+ 'data-wp-interactive' => 'test/router-script-modules-charlie',
26
+ )
27
+ );
28
+ ?>
29
+ <div <?php echo $wrapper_attributes; ?>>
30
+ <span data-testid="text" data-wp-text="state.name"></span>
31
+ <button data-testid="static" data-wp-on--click="actions.updateFromStatic">Static</button>
32
+ <button data-testid="dynamic" data-wp-on--click="actions.updateFromDynamic">Dynamic</button>
33
+ <button data-testid="initial-static" data-wp-on--click="actions.updateFromInitialStatic">Static (initial)</button>
34
+ <button data-testid="initial-dynamic" data-wp-on--click="actions.updateFromInitialDynamic">Dynamic (initial)</button>
35
+ </div>
@@ -0,0 +1,15 @@
1
+ <?php return array(
2
+ 'dependencies' => array(
3
+ '@wordpress/interactivity',
4
+ 'test/router-script-modules-charlie-1',
5
+ 'test/router-script-modules-initial-1',
6
+ array(
7
+ 'id' => 'test/router-script-modules-charlie-2',
8
+ 'import' => 'dynamic',
9
+ ),
10
+ array(
11
+ 'id' => 'test/router-script-modules-initial-2',
12
+ 'import' => 'dynamic',
13
+ ),
14
+ ),
15
+ );
@@ -0,0 +1,43 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store } from '@wordpress/interactivity';
5
+
6
+ /**
7
+ * External dependencies
8
+ */
9
+ // eslint-disable-next-line import/no-unresolved
10
+ import nameStatic from 'test/router-script-modules-charlie-1';
11
+ // eslint-disable-next-line import/no-unresolved
12
+ import nameInitialStatic from 'test/router-script-modules-initial-1';
13
+
14
+ const { state } = store( 'test/router-script-modules-charlie', {
15
+ state: {
16
+ name: 'charlie',
17
+ },
18
+ actions: {
19
+ updateFromStatic() {
20
+ state.name = nameStatic;
21
+ },
22
+ updateFromInitialStatic() {
23
+ state.name = nameInitialStatic;
24
+ },
25
+ *updateFromDynamic() {
26
+ const { default: nameDynamic } = yield import(
27
+ // eslint-disable-next-line import/no-unresolved
28
+ 'test/router-script-modules-charlie-2'
29
+ );
30
+ state.name = nameDynamic;
31
+ },
32
+ *updateFromInitialDynamic() {
33
+ const { default: nameInitialDynamic } = yield import(
34
+ // eslint-disable-next-line import/no-unresolved
35
+ 'test/router-script-modules-initial-2'
36
+ );
37
+ state.name = nameInitialDynamic;
38
+ },
39
+ },
40
+ } );
41
+
42
+ const { actions } = store( 'test/router-script-modules' );
43
+ actions.pushName?.( state.name );
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-script-modules-wrapper",
5
+ "title": "E2E Interactivity tests - router modules - Wrapper",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewScriptModule": "file:./view.js",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1 @@
1
+ export default 'initial-1';
@@ -0,0 +1 @@
1
+ export default 'initial-2';
@@ -0,0 +1,60 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's script module assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+ $modules = array( 'initial-1', 'initial-2' );
10
+
11
+ foreach ( $modules as $module ) {
12
+ $module_path = '/module-' . $module . '.js';
13
+ wp_register_script_module(
14
+ 'test/router-script-modules-' . $module,
15
+ plugins_url( $module_path, __FILE__ ),
16
+ array(),
17
+ filemtime( plugin_dir_path( __FILE__ ) . $module_path )
18
+ );
19
+ }
20
+
21
+ $wrapper_attributes = get_block_wrapper_attributes();
22
+ ?>
23
+ <div <?php echo $wrapper_attributes; ?>>
24
+ <!-- A name is appended here every time a module is executed. -->
25
+ <p data-testid="names" data-wp-text="state.names"></p>
26
+
27
+ <!-- Links to pages with different blocks combination. -->
28
+ <nav data-wp-interactive="test/router-script-modules">
29
+ <?php if ( isset( $attributes['links'] ) ) : ?>
30
+ <?php foreach ( $attributes['links'] as $label => $link ) : ?>
31
+ <a
32
+ data-testid="link <?php echo $label; ?>"
33
+ data-wp-on--click="actions.navigate"
34
+ data-wp-on-async--mouseenter="actions.prefetch"
35
+ href="<?php echo $link; ?>"
36
+ >
37
+ <?php echo $label; ?>
38
+ </a>
39
+ <?php endforeach; ?>
40
+ <?php endif; ?>
41
+ </nav>
42
+
43
+ <!-- HTML updated on navigation. -->
44
+ <div
45
+ data-wp-interactive="test/router-script-modules"
46
+ data-wp-router-region="router-script-modules"
47
+ >
48
+ <?php echo $content; ?>
49
+ </div>
50
+
51
+ <!-- Text to check whether a navigation was client-side. -->
52
+ <div
53
+ data-testid="client-side navigation"
54
+ data-wp-interactive="test/router-script-modules"
55
+ data-wp-bind--hidden="!state.clientSideNavigation"
56
+ hidden
57
+ >
58
+ Client-side navigation
59
+ </div>
60
+ </div>
@@ -0,0 +1,14 @@
1
+ <?php return array(
2
+ 'dependencies' => array(
3
+ '@wordpress/interactivity',
4
+ array(
5
+ 'id' => '@wordpress/interactivity-router',
6
+ 'import' => 'dynamic',
7
+ ),
8
+ 'test/router-script-modules-initial-1',
9
+ array(
10
+ 'id' => 'test/router-script-modules-initial-2',
11
+ 'import' => 'dynamic',
12
+ ),
13
+ ),
14
+ );
@@ -0,0 +1,32 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store, getElement } from '@wordpress/interactivity';
5
+
6
+ const { state } = store( 'test/router-script-modules', {
7
+ state: {
8
+ clientSideNavigation: false,
9
+ names: [],
10
+ },
11
+ actions: {
12
+ *navigate( e ) {
13
+ e.preventDefault();
14
+ state.clientSideNavigation = false;
15
+ const { actions } = yield import(
16
+ '@wordpress/interactivity-router'
17
+ );
18
+ yield actions.navigate( e.target.href );
19
+ state.clientSideNavigation = true;
20
+ },
21
+ *prefetch() {
22
+ const { ref } = getElement();
23
+ const { actions } = yield import(
24
+ '@wordpress/interactivity-router'
25
+ );
26
+ yield actions.prefetch( ref.href );
27
+ },
28
+ pushName( name ) {
29
+ state.names.push( name );
30
+ },
31
+ },
32
+ } );
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-styles-blue",
5
+ "title": "E2E Interactivity tests - router styles - Blue",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewStyle": "file:./style.css",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's style assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ add_action(
11
+ 'wp_enqueue_scripts',
12
+ function () {
13
+ wp_enqueue_style(
14
+ 'blue-from-link',
15
+ plugin_dir_url( __FILE__ ) . 'style-from-link.css',
16
+ array()
17
+ );
18
+
19
+ $custom_css = '
20
+ .blue-from-inline {
21
+ color: rgb(0, 0, 255);
22
+ }
23
+ ';
24
+
25
+ wp_register_style( 'test-router-styles', false );
26
+ wp_enqueue_style( 'test-router-styles' );
27
+ wp_add_inline_style( 'test-router-styles', $custom_css );
28
+ }
29
+ );
30
+
31
+ $wrapper_attributes = get_block_wrapper_attributes(
32
+ array( 'data-testid' => 'blue-block' )
33
+ );
34
+ ?>
35
+ <p <?php echo $wrapper_attributes; ?>>Blue</p>
@@ -0,0 +1,7 @@
1
+ .blue-from-link {
2
+ color: rgb(0, 0, 255);
3
+ }
4
+
5
+ .background-from-link {
6
+ background-image: url('./assets/10x10_e2e_test_image_blue.png');
7
+ }
@@ -0,0 +1,4 @@
1
+ .wp-block-test-router-styles-blue,
2
+ .blue {
3
+ color: rgb(0, 0, 255);
4
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-styles-green",
5
+ "title": "E2E Interactivity tests - router styles - Green",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewStyle": "file:./style.css",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's style assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ add_action(
11
+ 'wp_enqueue_scripts',
12
+ function () {
13
+ wp_enqueue_style(
14
+ 'green-from-link',
15
+ plugin_dir_url( __FILE__ ) . 'style-from-link.css',
16
+ array()
17
+ );
18
+
19
+ $custom_css = '
20
+ .green-from-inline {
21
+ color: rgb(0, 255, 0);
22
+ }
23
+ ';
24
+
25
+ wp_register_style( 'test-router-styles', false );
26
+ wp_enqueue_style( 'test-router-styles' );
27
+ wp_add_inline_style( 'test-router-styles', $custom_css );
28
+ }
29
+ );
30
+
31
+ $wrapper_attributes = get_block_wrapper_attributes(
32
+ array( 'data-testid' => 'green-block' )
33
+ );
34
+ ?>
35
+ <p <?php echo $wrapper_attributes; ?>>Green</p>
@@ -0,0 +1,7 @@
1
+ .green-from-link {
2
+ color: rgb(0, 255, 0);
3
+ }
4
+
5
+ .background-from-link {
6
+ background-image: url('./assets/10x10_e2e_test_image_green.png');
7
+ }
@@ -0,0 +1,4 @@
1
+ .wp-block-test-router-styles-green,
2
+ .green {
3
+ color: rgb(0, 255, 0);
4
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-styles-red",
5
+ "title": "E2E Interactivity tests - router styles - Red",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewStyle": "file:./style.css",
14
+ "render": "file:./render.php"
15
+ }
@@ -0,0 +1,35 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's style assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ add_action(
11
+ 'wp_enqueue_scripts',
12
+ function () {
13
+ wp_enqueue_style(
14
+ 'red-from-link',
15
+ plugin_dir_url( __FILE__ ) . 'style-from-link.css',
16
+ array()
17
+ );
18
+
19
+ $custom_css = '
20
+ .red-from-inline {
21
+ color: rgb(255, 0, 0);
22
+ }
23
+ ';
24
+
25
+ wp_register_style( 'test-router-styles', false );
26
+ wp_enqueue_style( 'test-router-styles' );
27
+ wp_add_inline_style( 'test-router-styles', $custom_css );
28
+ }
29
+ );
30
+
31
+ $wrapper_attributes = get_block_wrapper_attributes(
32
+ array( 'data-testid' => 'red-block' )
33
+ );
34
+ ?>
35
+ <p <?php echo $wrapper_attributes; ?>>Red</p>
@@ -0,0 +1,7 @@
1
+ .red-from-link {
2
+ color: rgb(255, 0, 0);
3
+ }
4
+
5
+ .background-from-link {
6
+ background-image: url('./assets/10x10_e2e_test_image_red.png');
7
+ }
@@ -0,0 +1,4 @@
1
+ .wp-block-test-router-styles-red,
2
+ .red {
3
+ color: rgb(255, 0, 0);
4
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
3
+ "apiVersion": 2,
4
+ "name": "test/router-styles-wrapper",
5
+ "title": "E2E Interactivity tests - router styles - Wrapper",
6
+ "category": "text",
7
+ "icon": "heart",
8
+ "description": "",
9
+ "supports": {
10
+ "interactivity": true
11
+ },
12
+ "textdomain": "e2e-interactivity",
13
+ "viewScriptModule": "file:./view.js",
14
+ "viewStyle": "file:./style.css",
15
+ "render": "file:./render.php"
16
+ }
@@ -0,0 +1,94 @@
1
+ <?php
2
+ /**
3
+ * HTML for testing the iAPI's style assets management.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ *
7
+ * @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
8
+ */
9
+
10
+ add_action(
11
+ 'wp_enqueue_scripts',
12
+ function () {
13
+ wp_enqueue_style(
14
+ 'wrapper-styles-from-link',
15
+ plugin_dir_url( __FILE__ ) . 'style-from-link.css',
16
+ array()
17
+ );
18
+ }
19
+ );
20
+
21
+ $wrapper_attributes = get_block_wrapper_attributes();
22
+ ?>
23
+ <div <?php echo $wrapper_attributes; ?>>
24
+ <!-- These get colored when the corresponding block is present. -->
25
+ <fieldset>
26
+ <legend>Styles from block styles</legend>
27
+ <p data-testid="red" class="red">Red</p>
28
+ <p data-testid="green" class="green">Green</p>
29
+ <p data-testid="blue" class="blue">Blue</p>
30
+ <p data-testid="all" class="red green blue">All</p>
31
+ </fieldset>
32
+
33
+ <!-- These get colored when the corresponding block enqueues a referenced stylesheet. -->
34
+ <fieldset>
35
+ <legend>Styles from referenced style sheets</legend>
36
+ <p data-testid="red-from-link" class="red-from-link">Red from link</p>
37
+ <p data-testid="green-from-link" class="green-from-link">Green from link</p>
38
+ <p data-testid="blue-from-link" class="blue-from-link">Blue from link</p>
39
+ <p data-testid="all-from-link" class="red-from-link green-from-link blue-from-link">All from link</p>
40
+ <div data-testid="background-from-link"class="background-from-link" style="width: 10px; height: 10px"></div>
41
+ </fieldset>
42
+
43
+ <!-- These get colored when the corresponding block adds inline style. -->
44
+ <fieldset>
45
+ <legend>Styles from inline styles</legend>
46
+ <p data-testid="red-from-inline" class="red-from-inline">Red</p>
47
+ <p data-testid="green-from-inline" class="green-from-inline">Green</p>
48
+ <p data-testid="blue-from-inline" class="blue-from-inline">Blue</p>
49
+ <p data-testid="all-from-inline" class="red-from-inline green-from-inline blue-from-inline">All</p>
50
+ </fieldset>
51
+
52
+ <!-- This one should remain green after navigation. -->
53
+ <fieldset>
54
+ <legend>Rule order checker</legend>
55
+ <p data-testid="order-checker" class="order-checker">I should remain green</p>
56
+ </fieldset>
57
+
58
+ <!-- Links to pages with different blocks combination. -->
59
+ <nav data-wp-interactive="test/router-styles">
60
+ <?php foreach ( $attributes['links'] as $label => $link ) : ?>
61
+ <a
62
+ data-testid="link <?php echo $label; ?>"
63
+ data-wp-on--click="actions.navigate"
64
+ data-wp-on-async--mouseenter="actions.prefetch"
65
+ href="<?php echo $link; ?>"
66
+ >
67
+ <?php echo $label; ?>
68
+ </a>
69
+ <?php endforeach; ?>
70
+ </nav>
71
+
72
+ <!-- HTML updated on navigation. -->
73
+ <div
74
+ data-wp-interactive="test/router-styles"
75
+ data-wp-router-region="router-styles"
76
+ >
77
+ <?php echo $content; ?>
78
+ </div>
79
+
80
+ <!-- Text to check whether a navigation was client-side. -->
81
+ <div
82
+ data-testid="client-side navigation"
83
+ data-wp-interactive="test/router-styles"
84
+ data-wp-bind--hidden="!state.clientSideNavigation"
85
+ hidden
86
+ >
87
+ Client-side navigation
88
+ </div>
89
+
90
+ <!-- Text to check whether a page is being prefetched. -->
91
+ <div data-wp-interactive="test/router-styles" >
92
+ Prefetching: <span data-testid="prefetching" data-wp-text="state.prefetching"></span>
93
+ </div>
94
+ </div>
@@ -0,0 +1,7 @@
1
+ .wp-block-test-router-styles-wrapper .order-checker {
2
+ color: rgb(255, 0, 0);
3
+ }
4
+
5
+ .wp-block-test-router-styles-wrapper .order-checker {
6
+ color: rgb(0, 255, 0);
7
+ }
@@ -0,0 +1,3 @@
1
+ .wp-block-test-router-styles-wrapper {
2
+ color: rgb(160, 12, 60);
3
+ }
@@ -0,0 +1,9 @@
1
+ <?php return array(
2
+ 'dependencies' => array(
3
+ '@wordpress/interactivity',
4
+ array(
5
+ 'id' => '@wordpress/interactivity-router',
6
+ 'import' => 'dynamic',
7
+ ),
8
+ ),
9
+ );
@@ -0,0 +1,31 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { store, getElement } from '@wordpress/interactivity';
5
+
6
+ const { state } = store( 'test/router-styles', {
7
+ state: {
8
+ clientSideNavigation: false,
9
+ prefetching: false,
10
+ },
11
+ actions: {
12
+ *navigate( e ) {
13
+ e.preventDefault();
14
+ state.clientSideNavigation = false;
15
+ const { actions } = yield import(
16
+ '@wordpress/interactivity-router'
17
+ );
18
+ yield actions.navigate( e.target.href );
19
+ state.clientSideNavigation = true;
20
+ },
21
+ *prefetch() {
22
+ state.prefetching = true;
23
+ const { ref } = getElement();
24
+ const { actions } = yield import(
25
+ '@wordpress/interactivity-router'
26
+ );
27
+ yield actions.prefetch( ref.href );
28
+ state.prefetching = false;
29
+ },
30
+ },
31
+ } );
@@ -59,7 +59,7 @@ if ( 'missing' !== $attributes['condition'] ) {
59
59
  }
60
60
 
61
61
  echo <<<HTML
62
- <script type="application/json" id="wp-interactivity-data">
62
+ <script type="application/json" id="wp-script-module-data-@wordpress/interactivity">
63
63
  $test_store_tag_json
64
64
  </script>
65
65
  HTML;
@@ -1,5 +1,6 @@
1
1
  const processingInstructions = `
2
2
  <div>
3
+ <div>Processing instruction is <?xpacket ##last-child## ?></div>
3
4
  <?xpacket ##1## ?>
4
5
  <div data-testid="it should keep this node between processing instructions">
5
6
  Processing instructions inner node
@@ -12,6 +12,7 @@ $src_cdata = $plugin_url . 'tovdom/cdata.js';
12
12
 
13
13
  <div data-wp-interactive="tovdom">
14
14
  <div data-testid="it should delete comments">
15
+ <div>Comment is <!-- ##last-child## --></div>
15
16
  <!-- ##1## -->
16
17
  <div data-testid="it should keep this node between comments">
17
18
  Comments inner node
@@ -25,7 +25,10 @@ add_action(
25
25
  * required to ensure that client hydration works even when the rendered
26
26
  * HTML contains unbalanced tags and it couldn't be processed in the server.
27
27
  */
28
- if ( 'true' === $_GET['disable_server_directive_processing'] ) {
28
+ if (
29
+ isset( $_GET['disable_server_directive_processing'] ) &&
30
+ 'true' === $_GET['disable_server_directive_processing']
31
+ ) {
29
32
  // Ensure the interactivity API is loaded.
30
33
  wp_interactivity();
31
34
  // But remove the server directive processing.