@wordpress/e2e-tests 7.23.0 → 7.25.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 +4 -0
- package/package.json +9 -9
- package/plugins/block-bindings.php +19 -1
- package/plugins/interactive-blocks/deferred-store/block.json +15 -0
- package/plugins/interactive-blocks/deferred-store/render.php +15 -0
- package/plugins/interactive-blocks/deferred-store/view.asset.php +1 -0
- package/plugins/interactive-blocks/deferred-store/view.js +20 -0
- package/plugins/interactive-blocks/directive-bind/block.json +1 -1
- package/plugins/interactive-blocks/directive-bind/render.php +0 -2
- package/plugins/interactive-blocks/directive-bind/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-class/block.json +1 -1
- package/plugins/interactive-blocks/directive-class/render.php +0 -2
- package/plugins/interactive-blocks/directive-class/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-context/block.json +1 -1
- package/plugins/interactive-blocks/directive-context/render.php +71 -2
- package/plugins/interactive-blocks/directive-context/view.asset.php +9 -0
- package/plugins/interactive-blocks/directive-context/view.js +60 -7
- package/plugins/interactive-blocks/directive-each/block.json +1 -1
- package/plugins/interactive-blocks/directive-each/render.php +0 -2
- package/plugins/interactive-blocks/directive-each/view.asset.php +9 -0
- package/plugins/interactive-blocks/directive-init/block.json +1 -1
- package/plugins/interactive-blocks/directive-init/render.php +0 -2
- package/plugins/interactive-blocks/directive-init/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-key/block.json +1 -1
- package/plugins/interactive-blocks/directive-key/render.php +0 -2
- package/plugins/interactive-blocks/directive-key/view.asset.php +9 -0
- package/plugins/interactive-blocks/directive-on/block.json +1 -1
- package/plugins/interactive-blocks/directive-on/render.php +0 -2
- package/plugins/interactive-blocks/directive-on/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-on-document/block.json +1 -1
- package/plugins/interactive-blocks/directive-on-document/render.php +0 -2
- package/plugins/interactive-blocks/directive-on-document/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-on-window/block.json +1 -1
- package/plugins/interactive-blocks/directive-on-window/render.php +0 -2
- package/plugins/interactive-blocks/directive-on-window/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-priorities/block.json +1 -1
- package/plugins/interactive-blocks/directive-priorities/render.php +0 -2
- package/plugins/interactive-blocks/directive-priorities/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-run/block.json +1 -1
- package/plugins/interactive-blocks/directive-run/render.php +0 -2
- package/plugins/interactive-blocks/directive-run/view.asset.php +9 -0
- package/plugins/interactive-blocks/directive-style/block.json +1 -1
- package/plugins/interactive-blocks/directive-style/render.php +0 -2
- package/plugins/interactive-blocks/directive-style/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-text/block.json +1 -1
- package/plugins/interactive-blocks/directive-text/render.php +0 -2
- package/plugins/interactive-blocks/directive-text/view.asset.php +1 -0
- package/plugins/interactive-blocks/directive-watch/block.json +1 -1
- package/plugins/interactive-blocks/directive-watch/render.php +0 -2
- package/plugins/interactive-blocks/directive-watch/view.asset.php +1 -0
- package/plugins/interactive-blocks/generator-scope/block.json +15 -0
- package/plugins/interactive-blocks/generator-scope/render.php +16 -0
- package/plugins/interactive-blocks/generator-scope/view.asset.php +1 -0
- package/plugins/interactive-blocks/generator-scope/view.js +23 -0
- package/plugins/interactive-blocks/negation-operator/block.json +1 -1
- package/plugins/interactive-blocks/negation-operator/render.php +0 -2
- package/plugins/interactive-blocks/negation-operator/view.asset.php +1 -0
- package/plugins/interactive-blocks/router-navigate/block.json +1 -1
- package/plugins/interactive-blocks/router-navigate/render.php +37 -22
- package/plugins/interactive-blocks/router-navigate/view.asset.php +9 -0
- package/plugins/interactive-blocks/router-navigate/view.js +13 -4
- package/plugins/interactive-blocks/router-regions/block.json +1 -1
- package/plugins/interactive-blocks/router-regions/render.php +0 -2
- package/plugins/interactive-blocks/router-regions/view.asset.php +9 -0
- package/plugins/interactive-blocks/store/block.json +1 -1
- package/plugins/interactive-blocks/store/render.php +2 -3
- package/plugins/interactive-blocks/store/view.asset.php +1 -0
- package/plugins/interactive-blocks/store/view.js +7 -4
- package/plugins/interactive-blocks/store-tag/block.json +1 -1
- package/plugins/interactive-blocks/store-tag/render.php +0 -2
- package/plugins/interactive-blocks/store-tag/view.asset.php +1 -0
- package/plugins/interactive-blocks/tovdom/block.json +1 -1
- package/plugins/interactive-blocks/tovdom/render.php +0 -2
- package/plugins/interactive-blocks/tovdom/view.asset.php +1 -0
- package/plugins/interactive-blocks/tovdom-islands/block.json +1 -1
- package/plugins/interactive-blocks/tovdom-islands/render.php +0 -2
- package/plugins/interactive-blocks/tovdom-islands/view.asset.php +1 -0
- package/plugins/interactive-blocks/with-scope/block.json +1 -1
- package/plugins/interactive-blocks/with-scope/render.php +0 -2
- package/plugins/interactive-blocks/with-scope/view.asset.php +1 -0
- package/plugins/interactive-blocks.php +4 -21
- package/specs/editor/various/autosave.test.js +0 -346
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.25.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,13 +23,13 @@
|
|
23
23
|
"node": ">=14"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^10.
|
27
|
-
"@wordpress/interactivity": "^5.
|
28
|
-
"@wordpress/interactivity-router": "^1.
|
29
|
-
"@wordpress/jest-console": "^7.
|
30
|
-
"@wordpress/jest-puppeteer-axe": "^6.
|
31
|
-
"@wordpress/scripts": "^27.
|
32
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^10.25.0",
|
27
|
+
"@wordpress/interactivity": "^5.3.0",
|
28
|
+
"@wordpress/interactivity-router": "^1.4.0",
|
29
|
+
"@wordpress/jest-console": "^7.25.0",
|
30
|
+
"@wordpress/jest-puppeteer-axe": "^6.25.0",
|
31
|
+
"@wordpress/scripts": "^27.5.0",
|
32
|
+
"@wordpress/url": "^3.55.0",
|
33
33
|
"chalk": "^4.0.0",
|
34
34
|
"expect-puppeteer": "^4.4.0",
|
35
35
|
"filenamify": "^4.2.0",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "ffc07735d0abfb3f69e91d48f25b7fe8d1ef92d2"
|
50
50
|
}
|
@@ -21,7 +21,6 @@ function gutenberg_test_block_bindings_register_custom_fields() {
|
|
21
21
|
'default' => 'Value of the text_custom_field',
|
22
22
|
)
|
23
23
|
);
|
24
|
-
// TODO: Change url.
|
25
24
|
register_meta(
|
26
25
|
'post',
|
27
26
|
'url_custom_field',
|
@@ -32,5 +31,24 @@ function gutenberg_test_block_bindings_register_custom_fields() {
|
|
32
31
|
'default' => '#url-custom-field',
|
33
32
|
)
|
34
33
|
);
|
34
|
+
register_meta(
|
35
|
+
'post',
|
36
|
+
'_protected_field',
|
37
|
+
array(
|
38
|
+
'type' => 'string',
|
39
|
+
'single' => true,
|
40
|
+
'default' => 'protected field value',
|
41
|
+
)
|
42
|
+
);
|
43
|
+
register_meta(
|
44
|
+
'post',
|
45
|
+
'show_in_rest_false_field',
|
46
|
+
array(
|
47
|
+
'show_in_rest' => false,
|
48
|
+
'type' => 'string',
|
49
|
+
'single' => true,
|
50
|
+
'default' => 'show_in_rest false field value',
|
51
|
+
)
|
52
|
+
);
|
35
53
|
}
|
36
54
|
add_action( 'init', 'gutenberg_test_block_bindings_register_custom_fields' );
|
@@ -0,0 +1,15 @@
|
|
1
|
+
{
|
2
|
+
"$schema": "https://schemas.wp.org/trunk/block.json",
|
3
|
+
"apiVersion": 2,
|
4
|
+
"name": "test/deferred-store",
|
5
|
+
"title": "E2E Interactivity tests - deferred store",
|
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,15 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* HTML for testing scope restoration with generators.
|
4
|
+
*
|
5
|
+
* @package gutenberg-test-interactive-blocks
|
6
|
+
*/
|
7
|
+
?>
|
8
|
+
|
9
|
+
<div
|
10
|
+
data-wp-interactive="test/deferred-store"
|
11
|
+
<?php echo wp_interactivity_data_wp_context( array( 'text' => '!dlrow ,olleH' ) ); ?>
|
12
|
+
>
|
13
|
+
<span data-wp-text="state.reversedText" data-testid="result"></span>
|
14
|
+
<span data-wp-text="state.reversedTextGetter" data-testid="result-getter"></span>
|
15
|
+
</div>
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/**
|
2
|
+
* WordPress dependencies
|
3
|
+
*/
|
4
|
+
import { store, getContext } from '@wordpress/interactivity';
|
5
|
+
|
6
|
+
document.addEventListener( 'DOMContentLoaded', () => {
|
7
|
+
setTimeout( () => {
|
8
|
+
store( 'test/deferred-store', {
|
9
|
+
state: {
|
10
|
+
reversedText() {
|
11
|
+
return [ ...getContext().text ].reverse().join( '' );
|
12
|
+
},
|
13
|
+
|
14
|
+
get reversedTextGetter() {
|
15
|
+
return [ ...getContext().text ].reverse().join( '' );
|
16
|
+
},
|
17
|
+
},
|
18
|
+
} );
|
19
|
+
}, 50 );
|
20
|
+
} );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -4,8 +4,6 @@
|
|
4
4
|
*
|
5
5
|
* @package gutenberg-test-interactive-blocks
|
6
6
|
*/
|
7
|
-
|
8
|
-
wp_enqueue_script_module( 'directive-context-view' );
|
9
7
|
?>
|
10
8
|
|
11
9
|
<div data-wp-interactive='{"namespace": "directive-context"}'>
|
@@ -18,6 +16,7 @@ wp_enqueue_script_module( 'directive-context-view' );
|
|
18
16
|
>
|
19
17
|
<!-- rendered during hydration -->
|
20
18
|
</pre>
|
19
|
+
<button data-testid="parent replace" data-wp-on--click="actions.replaceObj">Replace obj</button>
|
21
20
|
<button
|
22
21
|
data-testid="parent prop1"
|
23
22
|
name="prop1"
|
@@ -50,6 +49,14 @@ wp_enqueue_script_module( 'directive-context-view' );
|
|
50
49
|
>
|
51
50
|
obj.prop5
|
52
51
|
</button>
|
52
|
+
<button
|
53
|
+
data-testid="parent new"
|
54
|
+
name="new"
|
55
|
+
value="modifiedFromParent"
|
56
|
+
data-wp-on--click="actions.updateContext"
|
57
|
+
>
|
58
|
+
new
|
59
|
+
</button>
|
53
60
|
<div
|
54
61
|
data-wp-context='{ "prop2":"child","prop3":"child","obj":{"prop5":"child","prop6":"child"},"array":[4,5,6] }'
|
55
62
|
>
|
@@ -59,6 +66,7 @@ wp_enqueue_script_module( 'directive-context-view' );
|
|
59
66
|
>
|
60
67
|
<!-- rendered during hydration -->
|
61
68
|
</pre>
|
69
|
+
<button data-testid="child replace" data-wp-on--click="actions.replaceObj">Replace obj</button>
|
62
70
|
<button
|
63
71
|
data-testid="child prop1"
|
64
72
|
name="prop1"
|
@@ -107,6 +115,24 @@ wp_enqueue_script_module( 'directive-context-view' );
|
|
107
115
|
>
|
108
116
|
obj.prop6
|
109
117
|
</button>
|
118
|
+
<button
|
119
|
+
data-testid="child copy obj"
|
120
|
+
data-wp-on--click="actions.copyObj"
|
121
|
+
>
|
122
|
+
Copy obj
|
123
|
+
</button>
|
124
|
+
<div>
|
125
|
+
Is proxy preserved? <span
|
126
|
+
data-testid="is proxy preserved"
|
127
|
+
data-wp-text="state.isProxyPreserved"
|
128
|
+
></span>
|
129
|
+
</div>
|
130
|
+
<div>
|
131
|
+
Is proxy preserved on copy? <span
|
132
|
+
data-testid="is proxy preserved on copy"
|
133
|
+
data-wp-text="state.isProxyPreservedOnCopy"
|
134
|
+
></span>
|
135
|
+
</div>
|
110
136
|
</div>
|
111
137
|
<br />
|
112
138
|
|
@@ -127,10 +153,15 @@ wp_enqueue_script_module( 'directive-context-view' );
|
|
127
153
|
data-wp-router-region="navigation"
|
128
154
|
data-wp-context='{ "text": "first page" }'
|
129
155
|
>
|
156
|
+
<div data-wp-context='{}'>
|
157
|
+
<div data-testid="navigation inherited text" data-wp-text="context.text"></div>
|
158
|
+
<div data-testid="navigation inherited text2" data-wp-text="context.text2"></div>
|
159
|
+
</div>
|
130
160
|
<div data-testid="navigation text" data-wp-text="context.text"></div>
|
131
161
|
<div data-testid="navigation new text" data-wp-text="context.newText"></div>
|
132
162
|
<button data-testid="toggle text" data-wp-on--click="actions.toggleText">Toggle Text</button>
|
133
163
|
<button data-testid="add new text" data-wp-on--click="actions.addNewText">Add New Text</button>
|
164
|
+
<button data-testid="add text2" data-wp-on--click="actions.addText2">Add Text 2</button>
|
134
165
|
<button data-testid="navigate" data-wp-on--click="actions.navigate">Navigate</button>
|
135
166
|
<button data-testid="async navigate" data-wp-on--click="actions.asyncNavigate">Async Navigate</button>
|
136
167
|
</div>
|
@@ -143,3 +174,41 @@ wp_enqueue_script_module( 'directive-context-view' );
|
|
143
174
|
<span data-testid="non-default suffix context" data-wp-text="context.text"></span>
|
144
175
|
<span data-testid="default suffix context" data-wp-text="context.defaultText"></span>
|
145
176
|
</div>
|
177
|
+
|
178
|
+
<div
|
179
|
+
data-wp-interactive='directive-context'
|
180
|
+
data-wp-context='{ "list": [
|
181
|
+
{ "id": 1, "text": "Text 1" },
|
182
|
+
{ "id": 2, "text": "Text 2" }
|
183
|
+
] }'
|
184
|
+
>
|
185
|
+
<button data-testid="select 1" data-wp-on--click="actions.selectItem" value=1>Select 1</button>
|
186
|
+
<button data-testid="select 2" data-wp-on--click="actions.selectItem" value=2>Select 2</button>
|
187
|
+
<div data-testid="selected" data-wp-text="state.selected"></div>
|
188
|
+
</div>
|
189
|
+
|
190
|
+
<div
|
191
|
+
data-wp-interactive="directive-context-watch"
|
192
|
+
data-wp-context='{"counter":0}'
|
193
|
+
>
|
194
|
+
<button
|
195
|
+
data-testid="counter parent"
|
196
|
+
data-wp-on--click="actions.increment"
|
197
|
+
data-wp-text="context.counter"
|
198
|
+
></button>
|
199
|
+
<div
|
200
|
+
data-wp-context='{"counter":0, "changes":0}'
|
201
|
+
data-wp-watch="callbacks.countChanges"
|
202
|
+
>
|
203
|
+
<button
|
204
|
+
data-testid="counter child"
|
205
|
+
data-wp-on--click="actions.increment"
|
206
|
+
data-wp-text="context.counter"
|
207
|
+
>
|
208
|
+
</button>
|
209
|
+
<span
|
210
|
+
data-testid="counter changes"
|
211
|
+
data-wp-text="context.changes"
|
212
|
+
></span>
|
213
|
+
</div>
|
214
|
+
</div>
|
@@ -9,6 +9,19 @@ store( 'directive-context', {
|
|
9
9
|
const ctx = getContext();
|
10
10
|
return JSON.stringify( ctx, undefined, 2 );
|
11
11
|
},
|
12
|
+
get selected() {
|
13
|
+
const { list, selected } = getContext();
|
14
|
+
return list.find( ( obj ) => obj === selected )?.text;
|
15
|
+
},
|
16
|
+
get isProxyPreserved() {
|
17
|
+
const ctx = getContext();
|
18
|
+
const pointer = ctx.obj;
|
19
|
+
return pointer === ctx.obj;
|
20
|
+
},
|
21
|
+
get isProxyPreservedOnCopy() {
|
22
|
+
const { obj, obj2 } = getContext();
|
23
|
+
return obj === obj2;
|
24
|
+
}
|
12
25
|
},
|
13
26
|
actions: {
|
14
27
|
updateContext( event ) {
|
@@ -22,6 +35,19 @@ store( 'directive-context', {
|
|
22
35
|
const ctx = getContext();
|
23
36
|
ctx.text = ctx.text === 'Text 1' ? 'Text 2' : 'Text 1';
|
24
37
|
},
|
38
|
+
selectItem( event ) {
|
39
|
+
const ctx = getContext();
|
40
|
+
const value = parseInt( event.target.value );
|
41
|
+
ctx.selected = ctx.list.find( ( { id } ) => id === value );
|
42
|
+
},
|
43
|
+
replaceObj() {
|
44
|
+
const ctx = getContext();
|
45
|
+
ctx.obj = { overwritten: true };
|
46
|
+
},
|
47
|
+
copyObj() {
|
48
|
+
const ctx = getContext();
|
49
|
+
ctx.obj2 = ctx.obj;
|
50
|
+
}
|
25
51
|
},
|
26
52
|
} );
|
27
53
|
|
@@ -29,12 +55,17 @@ const html = `
|
|
29
55
|
<div
|
30
56
|
data-wp-interactive="directive-context-navigate"
|
31
57
|
data-wp-router-region="navigation"
|
32
|
-
data-wp-context='{ "text": "second page" }'
|
58
|
+
data-wp-context='{ "text": "second page", "text2": "second page" }'
|
33
59
|
>
|
60
|
+
<div data-wp-context='{}'>
|
61
|
+
<div data-testid="navigation inherited text" data-wp-text="context.text"></div>
|
62
|
+
<div data-testid="navigation inherited text2" data-wp-text="context.text2"></div>
|
63
|
+
</div>
|
34
64
|
<div data-testid="navigation text" data-wp-text="context.text"></div>
|
35
65
|
<div data-testid="navigation new text" data-wp-text="context.newText"></div>
|
36
66
|
<button data-testid="toggle text" data-wp-on--click="actions.toggleText">Toggle Text</button>
|
37
|
-
<button data-testid="add new text" data-wp-on--click="actions.addNewText">Add
|
67
|
+
<button data-testid="add new text" data-wp-on--click="actions.addNewText">Add New Text</button>
|
68
|
+
<button data-testid="add text2" data-wp-on--click="actions.addText2">Add Text 2</button>
|
38
69
|
<button data-testid="navigate" data-wp-on--click="actions.navigate">Navigate</button>
|
39
70
|
<button data-testid="async navigate" data-wp-on--click="actions.asyncNavigate">Async Navigate</button>
|
40
71
|
</div>`;
|
@@ -49,13 +80,17 @@ const { actions } = store( 'directive-context-navigate', {
|
|
49
80
|
const ctx = getContext();
|
50
81
|
ctx.newText = 'some new text';
|
51
82
|
},
|
83
|
+
addText2() {
|
84
|
+
const ctx = getContext();
|
85
|
+
ctx.text2 = 'some new text';
|
86
|
+
},
|
52
87
|
navigate() {
|
53
88
|
return import( '@wordpress/interactivity-router' ).then(
|
54
|
-
( { actions: routerActions } ) =>
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
89
|
+
( { actions: routerActions } ) => {
|
90
|
+
const url = new URL( window.location.href );
|
91
|
+
url.searchParams.set( 'next_page', 'true' );
|
92
|
+
return routerActions.navigate( url, { force: true, html } );
|
93
|
+
}
|
59
94
|
);
|
60
95
|
|
61
96
|
},
|
@@ -66,3 +101,21 @@ const { actions } = store( 'directive-context-navigate', {
|
|
66
101
|
},
|
67
102
|
},
|
68
103
|
} );
|
104
|
+
|
105
|
+
store( 'directive-context-watch', {
|
106
|
+
actions: {
|
107
|
+
increment: () => {
|
108
|
+
const ctx = getContext();
|
109
|
+
ctx.counter = ctx.counter + 1;
|
110
|
+
},
|
111
|
+
},
|
112
|
+
callbacks: {
|
113
|
+
countChanges: () => {
|
114
|
+
const ctx = getContext();
|
115
|
+
// Subscribe to changes in counter.
|
116
|
+
// eslint-disable-next-line no-unused-expressions
|
117
|
+
ctx.counter;
|
118
|
+
ctx.changes = ctx.changes + 1;
|
119
|
+
},
|
120
|
+
},
|
121
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|
@@ -0,0 +1 @@
|
|
1
|
+
<?php return array( 'dependencies' => array( '@wordpress/interactivity' ) );
|