@wordpress/e2e-tests 8.0.0 → 8.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 8.1.0 (2024-06-15)
6
+
5
7
  ## 8.0.0 (2024-05-31)
6
8
 
7
9
  ### Breaking Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "8.0.0",
3
+ "version": "8.1.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.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.1.0",
28
+ "@wordpress/interactivity": "^6.1.0",
29
+ "@wordpress/interactivity-router": "^2.1.0",
30
+ "@wordpress/jest-console": "^8.1.0",
31
+ "@wordpress/jest-puppeteer-axe": "^7.1.0",
32
+ "@wordpress/scripts": "^28.1.0",
33
+ "@wordpress/url": "^4.1.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": "2f30cddff15723ac7017fd009fc5913b7b419400"
50
+ "gitHead": "66d3bf12e67d16deddc4b4a9ec42e1d0bed3479a"
51
51
  }
@@ -56,12 +56,13 @@ class Test_Widget extends WP_Widget {
56
56
  /**
57
57
  * Handles updating settings for the current widget instance.
58
58
  *
59
+ * @since 4.8.1
60
+ *
59
61
  * @param array $new_instance New settings for this instance as input by the user via
60
62
  * WP_Widget::form().
61
63
  * @param array $old_instance Old settings for this instance.
62
64
  *
63
65
  * @return array Settings to save or bool false to cancel saving.
64
- * @since 4.8.1
65
66
  */
66
67
  // @codingStandardsIgnoreStart – to prevent phpcs from complaining about unused function argument.
67
68
  public function update( $new_instance, $old_instance ) {
@@ -3,8 +3,9 @@
3
3
  */
4
4
  import { store, getContext } from '@wordpress/interactivity';
5
5
 
6
- document.addEventListener( 'DOMContentLoaded', () => {
7
- setTimeout( () => {
6
+ window.addEventListener(
7
+ '_test_proceed_',
8
+ () => {
8
9
  store( 'test/deferred-store', {
9
10
  state: {
10
11
  reversedText() {
@@ -16,5 +17,6 @@ document.addEventListener( 'DOMContentLoaded', () => {
16
17
  },
17
18
  },
18
19
  } );
19
- }, 100 );
20
- } );
20
+ },
21
+ { once: true }
22
+ );
@@ -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
+