@wordpress/e2e-tests 9.22.0 → 10.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.
Files changed (29) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/package.json +5 -5
  3. package/plugins/animated-image-subsizes.php +10 -0
  4. package/plugins/autosave-failures.php +144 -0
  5. package/plugins/content-security-policy.php +43 -0
  6. package/plugins/entity-actions-api/close-comments.js +49 -0
  7. package/plugins/entity-actions-api.php +106 -0
  8. package/plugins/entity-fields-api/comment-status.css +24 -0
  9. package/plugins/entity-fields-api/comment-status.js +26 -0
  10. package/plugins/entity-fields-api/reading-time.css +21 -0
  11. package/plugins/entity-fields-api/reading-time.js +82 -0
  12. package/plugins/entity-fields-api.php +291 -0
  13. package/plugins/image-picture-wrapper.php +30 -0
  14. package/plugins/interactive-blocks/directive-context/render.php +2 -2
  15. package/plugins/interactive-blocks/directive-html/render.php +19 -7
  16. package/plugins/interactive-blocks/directive-html/view.js +21 -2
  17. package/plugins/interactive-blocks/hydration-timing-async/view.js +1 -1
  18. package/plugins/interactive-blocks/router-html/block.json +19 -0
  19. package/plugins/interactive-blocks/router-html/render.php +64 -0
  20. package/plugins/interactive-blocks/router-html/view.asset.php +9 -0
  21. package/plugins/interactive-blocks/router-html/view.js +56 -0
  22. package/plugins/interactive-blocks/router-html-regions/block.json +17 -0
  23. package/plugins/interactive-blocks/router-html-regions/render.php +77 -0
  24. package/plugins/interactive-blocks/router-html-regions/view.asset.php +15 -0
  25. package/plugins/interactive-blocks/router-html-regions/view.js +36 -0
  26. package/plugins/interactive-blocks/store-tag/render.php +3 -3
  27. package/plugins/interactive-blocks.php +12 -0
  28. package/plugins/react-18-compat-block/editor.js +38 -0
  29. package/plugins/rtc-websocket-provider/src/index.js +1 -1
@@ -0,0 +1,15 @@
1
+ <?php
2
+ /**
3
+ * Script module dependencies for HTML router regions.
4
+ *
5
+ * @package gutenberg-test-interactive-blocks
6
+ */
7
+ return array(
8
+ 'dependencies' => array(
9
+ '@wordpress/interactivity',
10
+ array(
11
+ 'id' => '@wordpress/interactivity-router',
12
+ 'import' => 'dynamic',
13
+ ),
14
+ ),
15
+ );
@@ -0,0 +1,36 @@
1
+ import {
2
+ asDangerousHTML,
3
+ store,
4
+ withSyncEvent,
5
+ } from '@wordpress/interactivity';
6
+
7
+ const { state } = store( 'router-html-regions', {
8
+ state: {
9
+ /** Number of directives initialized inside inert copies. */
10
+ marks: 0,
11
+ /** HTML supplied during hydration, outside every router region. */
12
+ inserted: asDangerousHTML(
13
+ '<div data-wp-interactive="router-html-regions" data-wp-router-region="html/r"><p>inserted</p></div>'
14
+ ),
15
+ },
16
+ actions: {
17
+ /** Records an initialization that must not occur inside HTML content. */
18
+ mark() {
19
+ state.marks++;
20
+ },
21
+ /**
22
+ * Navigates from a fixture link without a document reload.
23
+ *
24
+ * @param {MouseEvent} event Link click.
25
+ * @return {Object} Iterator yielding navigation completion.
26
+ */
27
+ navigate: withSyncEvent( function* ( event ) {
28
+ event.preventDefault();
29
+ // currentTarget is only available during synchronous event dispatch.
30
+ const href = event.currentTarget.href;
31
+ const { actions } =
32
+ yield import( '@wordpress/interactivity-router' );
33
+ yield actions.navigate( href );
34
+ } ),
35
+ },
36
+ } );
@@ -16,14 +16,14 @@ $test_store_tag_double = $test_store_tag_counter * 2;
16
16
  <div>
17
17
  Counter:
18
18
  <span
19
- data-wp-bind--children="state.counter.value"
19
+ data-wp-text="state.counter.value"
20
20
  data-testid="counter value"
21
21
  ><?php echo $test_store_tag_counter; ?></span
22
22
  >
23
23
  <br />
24
24
  Double:
25
25
  <span
26
- data-wp-bind--children="state.counter.double"
26
+ data-wp-text="state.counter.double"
27
27
  data-testid="counter double"
28
28
  ><?php echo $test_store_tag_double; ?></span
29
29
  >
@@ -35,7 +35,7 @@ $test_store_tag_double = $test_store_tag_counter * 2;
35
35
  +1
36
36
  </button>
37
37
  <span
38
- data-wp-bind--children="state.counter.clicks"
38
+ data-wp-text="state.counter.clicks"
39
39
  data-testid="counter clicks"
40
40
  >0</span
41
41
  >
@@ -36,3 +36,15 @@ add_action(
36
36
  }
37
37
  }
38
38
  );
39
+
40
+ add_action(
41
+ 'send_headers',
42
+ function () {
43
+ if (
44
+ isset( $_GET['require_trusted_types'] ) &&
45
+ 'true' === $_GET['require_trusted_types']
46
+ ) {
47
+ header( "Content-Security-Policy: require-trusted-types-for 'script'" );
48
+ }
49
+ }
50
+ );
@@ -1,6 +1,7 @@
1
1
  ( function () {
2
2
  const { registerBlockType } = wp.blocks;
3
3
  const { useBlockProps } = wp.blockEditor;
4
+ const { createElement, memo } = wp.element;
4
5
 
5
6
  // The externalized React JSX runtime (the `react-jsx-runtime` script
6
7
  // handle). When the React 19 experiment is enabled this is React 19's
@@ -89,6 +90,23 @@
89
90
  label: 'Hello from defaultProps',
90
91
  };
91
92
 
93
+ // The same, wrapped in `memo()`. React 18 resolved the inner component's
94
+ // `defaultProps` in `updateMemoComponent`, not at element creation, so no
95
+ // runtime ever wrote them into the element. All three ways of creating the
96
+ // element are exercised — the classic `createElement`, the externalized JSX
97
+ // runtime, and the bundled React 18 one — because the fix has to live in
98
+ // the reconciler to cover the last of them.
99
+ function MemoGreetingBase( props ) {
100
+ return jsx( 'span', {
101
+ className: props.className,
102
+ children: props.label,
103
+ } );
104
+ }
105
+ MemoGreetingBase.defaultProps = {
106
+ label: 'Hello from memo defaultProps',
107
+ };
108
+ const MemoGreeting = memo( MemoGreetingBase );
109
+
92
110
  registerBlockType( 'test/react-18-compat-block', {
93
111
  apiVersion: 3,
94
112
  edit: function Edit() {
@@ -122,6 +140,26 @@
122
140
  // The `defaultProps` component, created with the
123
141
  // externalized React runtime.
124
142
  jsx( Greeting, {}, 'greeting' ),
143
+ createElement( MemoGreeting, {
144
+ key: 'memo-greeting',
145
+ className: 'react-18-compat-block__memo-greeting',
146
+ } ),
147
+ jsx(
148
+ MemoGreeting,
149
+ {
150
+ className:
151
+ 'react-18-compat-block__memo-greeting-jsx',
152
+ },
153
+ 'memo-greeting-jsx'
154
+ ),
155
+ jsxDEV(
156
+ MemoGreeting,
157
+ {
158
+ className:
159
+ 'react-18-compat-block__memo-greeting-legacy',
160
+ },
161
+ 'memo-greeting-legacy'
162
+ ),
125
163
  ],
126
164
  } );
127
165
  },
@@ -2,7 +2,7 @@
2
2
  * Test-only WebSocket sync provider for Gutenberg RTC e2e tests.
3
3
  *
4
4
  * Speaks the y-websocket binary protocol against test/e2e/bin/rtc-test-ws-sync-server.mjs
5
- * (which is built on @y/websocket-server) so the test harness exercises the same
5
+ * (which is built on `@y/websocket-server`) so the test harness exercises the same
6
6
  * wire format as production deployments. Exposes a small debug surface on
7
7
  * window.__gutenbergTestWebSocketSync.rooms that the Playwright fixtures poll.
8
8
  */