@wordpress/e2e-tests 8.0.0 → 8.0.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "8.0.0",
3
+ "version": "8.0.1",
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.0.0",
28
- "@wordpress/interactivity": "^6.0.0",
29
- "@wordpress/interactivity-router": "^2.0.0",
30
- "@wordpress/jest-console": "^8.0.0",
31
- "@wordpress/jest-puppeteer-axe": "^7.0.0",
32
- "@wordpress/scripts": "^28.0.0",
33
- "@wordpress/url": "^4.0.0",
27
+ "@wordpress/e2e-test-utils": "^11.0.1",
28
+ "@wordpress/interactivity": "^6.0.1",
29
+ "@wordpress/interactivity-router": "^2.0.1",
30
+ "@wordpress/jest-console": "^8.0.1",
31
+ "@wordpress/jest-puppeteer-axe": "^7.0.1",
32
+ "@wordpress/scripts": "^28.0.1",
33
+ "@wordpress/url": "^4.0.1",
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": "2f30cddff15723ac7017fd009fc5913b7b419400"
50
+ "gitHead": "0e973525f7787401b5a544e0727774d52a78639f"
51
51
  }
@@ -234,3 +234,29 @@
234
234
  <p data-testid="item" data-wp-each-child>gamma</p>
235
235
  <p data-testid="item" data-wp-each-child>delta</p>
236
236
  </div>
237
+
238
+ <hr>
239
+
240
+ <div
241
+ data-wp-interactive="directive-each"
242
+ data-wp-context='{ "list": [ "beta" ], "callbackRunCount": 0 }'
243
+ data-testid="elements with directives"
244
+ >
245
+ <template data-wp-each="context.list">
246
+ <div
247
+ data-testid="item"
248
+ data-wp-text="context.item"
249
+ data-wp-priority-2-init="callbacks.updateCallbackRunCount"
250
+ ></div>
251
+ </template>
252
+ <div
253
+ data-wp-each-child
254
+ data-testid="item"
255
+ data-wp-text="context.item"
256
+ data-wp-priority-2-init="callbacks.updateCallbackRunCount"
257
+ ></div>
258
+ <data
259
+ data-testid="callbackRunCount"
260
+ data-wp-text="context.callbackRunCount"
261
+ ></data>
262
+ </div>
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { store, getContext } from '@wordpress/interactivity';
4
+ import { store, getContext, useInit, privateApis } from '@wordpress/interactivity';
5
5
 
6
6
  const { state } = store( 'directive-each' );
7
7
 
@@ -190,3 +190,30 @@ store( 'directive-each', {
190
190
  }
191
191
  } );
192
192
 
193
+ const { directive } = privateApis(
194
+ 'I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.'
195
+ );
196
+
197
+ /*
198
+ * This is a high-priority version of the wp-init directive, to test directives
199
+ * with such priority or lower don't run in elements with wp-each-child.
200
+ */
201
+ directive(
202
+ 'priority-2-init',
203
+ ( { directives: { 'priority-2-init': init }, evaluate } ) => {
204
+ init.forEach( ( entry ) => {
205
+ useInit( () => evaluate( entry ) );
206
+ } );
207
+ },
208
+ { priority: 2 }
209
+ );
210
+
211
+ store('directive-each', {
212
+ callbacks: {
213
+ updateCallbackRunCount() {
214
+ const ctx = getContext();
215
+ ctx.callbackRunCount += 1;
216
+ }
217
+ },
218
+ });
219
+