@wordpress/e2e-tests 8.4.0 → 8.6.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-template-registration.php +72 -0
- package/plugins/delete-installed-fonts.php +1 -1
- package/plugins/interactive-blocks/directive-context/render.php +21 -0
- package/plugins/interactive-blocks/directive-each/render.php +2 -2
- package/plugins/interactive-blocks/directive-each/view.js +8 -2
- package/plugins/interactive-blocks/directive-priorities/view.js +5 -5
- package/plugins/observe-typing/index.js +45 -0
- package/plugins/observe-typing.php +28 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "8.
|
3
|
+
"version": "8.6.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.
|
28
|
-
"@wordpress/interactivity": "^6.
|
29
|
-
"@wordpress/interactivity-router": "^2.
|
30
|
-
"@wordpress/jest-console": "^8.
|
31
|
-
"@wordpress/jest-puppeteer-axe": "^7.
|
32
|
-
"@wordpress/scripts": "^28.
|
33
|
-
"@wordpress/url": "^4.
|
27
|
+
"@wordpress/e2e-test-utils": "^11.6.0",
|
28
|
+
"@wordpress/interactivity": "^6.6.0",
|
29
|
+
"@wordpress/interactivity-router": "^2.6.0",
|
30
|
+
"@wordpress/jest-console": "^8.6.0",
|
31
|
+
"@wordpress/jest-puppeteer-axe": "^7.6.0",
|
32
|
+
"@wordpress/scripts": "^28.6.0",
|
33
|
+
"@wordpress/url": "^4.6.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": "
|
50
|
+
"gitHead": "ab9564947967bb3f00343130954b9efacba6cdd7"
|
51
51
|
}
|
@@ -0,0 +1,72 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test Block Template Registration
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-block-template-registration
|
8
|
+
*/
|
9
|
+
|
10
|
+
add_action(
|
11
|
+
'init',
|
12
|
+
function () {
|
13
|
+
// Custom template used by most tests.
|
14
|
+
wp_register_block_template(
|
15
|
+
'gutenberg//plugin-template',
|
16
|
+
array(
|
17
|
+
'title' => 'Plugin Template',
|
18
|
+
'description' => 'A template registered by a plugin.',
|
19
|
+
'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered template.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
|
20
|
+
'post_types' => array( 'post' ),
|
21
|
+
)
|
22
|
+
);
|
23
|
+
add_action(
|
24
|
+
'category_template_hierarchy',
|
25
|
+
function () {
|
26
|
+
return array( 'plugin-template' );
|
27
|
+
}
|
28
|
+
);
|
29
|
+
|
30
|
+
// Custom template overridden by the theme.
|
31
|
+
wp_register_block_template(
|
32
|
+
'gutenberg//custom-template',
|
33
|
+
array(
|
34
|
+
'title' => 'Custom Template (overridden by the theme)',
|
35
|
+
'description' => 'A custom template registered by a plugin and overridden by a theme.',
|
36
|
+
'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered template and overridden by a theme.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
|
37
|
+
'post_types' => array( 'post' ),
|
38
|
+
)
|
39
|
+
);
|
40
|
+
|
41
|
+
// Custom template used to test unregistration.
|
42
|
+
wp_register_block_template(
|
43
|
+
'gutenberg//plugin-unregistered-template',
|
44
|
+
array(
|
45
|
+
'title' => 'Plugin Unregistered Template',
|
46
|
+
'description' => 'A plugin-registered template that is unregistered.',
|
47
|
+
'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered template that is also unregistered.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
|
48
|
+
)
|
49
|
+
);
|
50
|
+
wp_unregister_block_template( 'gutenberg//plugin-unregistered-template' );
|
51
|
+
|
52
|
+
// Custom template used to test overriding default WP templates.
|
53
|
+
wp_register_block_template(
|
54
|
+
'gutenberg//page',
|
55
|
+
array(
|
56
|
+
'title' => 'Plugin Page Template',
|
57
|
+
'description' => 'A plugin-registered page template.',
|
58
|
+
'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered page template.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
|
59
|
+
)
|
60
|
+
);
|
61
|
+
|
62
|
+
// Custom template used to test overriding default WP templates which can be created by the user.
|
63
|
+
wp_register_block_template(
|
64
|
+
'gutenberg//author-admin',
|
65
|
+
array(
|
66
|
+
'title' => 'Plugin Author Template',
|
67
|
+
'description' => 'A plugin-registered author template.',
|
68
|
+
'content' => '<!-- wp:template-part {"slug":"header","tagName":"header"} /--><!-- wp:group {"tagName":"main","layout":{"inherit":true}} --><main class="wp-block-group"><!-- wp:paragraph --><p>This is a plugin-registered author template.</p><!-- /wp:paragraph --></main><!-- /wp:group -->',
|
69
|
+
)
|
70
|
+
);
|
71
|
+
}
|
72
|
+
);
|
@@ -56,7 +56,7 @@ function gutenberg_delete_installed_fonts() {
|
|
56
56
|
}
|
57
57
|
|
58
58
|
// Delete any installed fonts from global styles.
|
59
|
-
$global_styles_post_id =
|
59
|
+
$global_styles_post_id = WP_Theme_JSON_Resolver_Gutenberg::get_user_global_styles_post_id();
|
60
60
|
$request = new WP_REST_Request( 'POST', '/wp/v2/global-styles/' . $global_styles_post_id );
|
61
61
|
$request->set_body_params( array( 'settings' => array( 'typography' => array( 'fontFamilies' => array() ) ) ) );
|
62
62
|
|
@@ -212,3 +212,24 @@
|
|
212
212
|
></span>
|
213
213
|
</div>
|
214
214
|
</div>
|
215
|
+
|
216
|
+
|
217
|
+
<div
|
218
|
+
data-testid="inheritance from other namespaces"
|
219
|
+
data-wp-interactive="directive-context/parent"
|
220
|
+
data-wp-context='{ "prop": "fromParentNs" }'
|
221
|
+
>
|
222
|
+
<div
|
223
|
+
data-wp-interactive="directive-context/child"
|
224
|
+
data-wp-context='{ "prop": "fromChildNs" }'
|
225
|
+
>
|
226
|
+
<span
|
227
|
+
data-testid="parent"
|
228
|
+
data-wp-text="directive-context/parent::context.prop"
|
229
|
+
></span>
|
230
|
+
<span
|
231
|
+
data-testid="child"
|
232
|
+
data-wp-text="directive-context/child::context.prop"
|
233
|
+
></span>
|
234
|
+
</div>
|
235
|
+
</div>
|
@@ -220,14 +220,14 @@
|
|
220
220
|
<div
|
221
221
|
data-wp-interactive="directive-each"
|
222
222
|
data-wp-router-region="navigation-updated list"
|
223
|
-
data-wp-context='{ "
|
223
|
+
data-wp-context='{ "b": 2, "c": 3, "d": 4 }'
|
224
224
|
data-testid="navigation-updated list"
|
225
225
|
>
|
226
226
|
<button
|
227
227
|
data-testid="navigate"
|
228
228
|
data-wp-on--click="actions.navigate"
|
229
229
|
>Navigate</button>
|
230
|
-
<template data-wp-each="
|
230
|
+
<template data-wp-each="state.list">
|
231
231
|
<p data-wp-text="context.item" data-testid="item"></p>
|
232
232
|
</template>
|
233
233
|
<p data-testid="item" data-wp-each-child>beta</p>
|
@@ -169,14 +169,14 @@ const html = `
|
|
169
169
|
<div
|
170
170
|
data-wp-interactive="directive-each"
|
171
171
|
data-wp-router-region="navigation-updated list"
|
172
|
-
data-wp-context='{ "
|
172
|
+
data-wp-context='{ "a": 1, "b": 2, "c": 3, "d": 4 }'
|
173
173
|
data-testid="navigation-updated list"
|
174
174
|
>
|
175
175
|
<button
|
176
176
|
data-testid="navigate"
|
177
177
|
data-wp-on--click="actions.navigate"
|
178
178
|
>Navigate</button>
|
179
|
-
<template data-wp-each="
|
179
|
+
<template data-wp-each="state.list">
|
180
180
|
<p data-wp-text="context.item" data-testid="item"></p>
|
181
181
|
</template>
|
182
182
|
<p data-testid="item" data-wp-each-child>alpha</p>
|
@@ -187,6 +187,12 @@ const html = `
|
|
187
187
|
`;
|
188
188
|
|
189
189
|
store( 'directive-each', {
|
190
|
+
state: {
|
191
|
+
get list() {
|
192
|
+
const ctx = getContext();
|
193
|
+
return Object.keys( ctx ).sort();
|
194
|
+
},
|
195
|
+
},
|
190
196
|
actions: {
|
191
197
|
*navigate() {
|
192
198
|
const { actions } = yield import(
|
@@ -8,7 +8,7 @@ import {
|
|
8
8
|
privateApis,
|
9
9
|
} from '@wordpress/interactivity';
|
10
10
|
|
11
|
-
const { directive,
|
11
|
+
const { directive, proxifyState, h } = privateApis(
|
12
12
|
'I acknowledge that using private APIs means my theme or plugin will inevitably break in the next version of WordPress.'
|
13
13
|
);
|
14
14
|
|
@@ -41,12 +41,12 @@ directive(
|
|
41
41
|
'test-context',
|
42
42
|
( { context: { Provider }, props: { children } } ) => {
|
43
43
|
executionProof( 'context' );
|
44
|
-
const value =
|
45
|
-
[ namespace ]: {
|
44
|
+
const value = {
|
45
|
+
[ namespace ]: proxifyState( namespace, {
|
46
46
|
attribute: 'from context',
|
47
47
|
text: 'from context',
|
48
|
-
},
|
49
|
-
}
|
48
|
+
} ),
|
49
|
+
};
|
50
50
|
return h( Provider, { value }, children );
|
51
51
|
},
|
52
52
|
{ priority: 8 }
|
@@ -0,0 +1,45 @@
|
|
1
|
+
( function () {
|
2
|
+
const { registerBlockType } = wp.blocks;
|
3
|
+
const { useBlockProps, BlockControls } = wp.blockEditor;
|
4
|
+
const { Dropdown, ToolbarButton, TextControl } = wp.components;
|
5
|
+
const { createElement: el, useState } = wp.element;
|
6
|
+
|
7
|
+
registerBlockType( 'e2e-tests/observe-typing', {
|
8
|
+
apiVersion: 3,
|
9
|
+
title: 'Observe Typing',
|
10
|
+
description: 'Observe Typing test block.',
|
11
|
+
category: 'widgets',
|
12
|
+
edit: function Edit() {
|
13
|
+
const [ value, setValue ] = useState( '' );
|
14
|
+
const blockProps = useBlockProps();
|
15
|
+
|
16
|
+
return el(
|
17
|
+
'div',
|
18
|
+
blockProps,
|
19
|
+
el(
|
20
|
+
BlockControls,
|
21
|
+
{ group: 'block' },
|
22
|
+
el( Dropdown, {
|
23
|
+
renderToggle: ( { onToggle } ) =>
|
24
|
+
el(
|
25
|
+
ToolbarButton,
|
26
|
+
{
|
27
|
+
onClick: onToggle,
|
28
|
+
},
|
29
|
+
'Open Dropdown'
|
30
|
+
),
|
31
|
+
renderContent: () =>
|
32
|
+
el( TextControl, {
|
33
|
+
label: 'Dropdown field',
|
34
|
+
value,
|
35
|
+
onChange: setValue,
|
36
|
+
__next40pxDefaultSize: true,
|
37
|
+
} ),
|
38
|
+
} )
|
39
|
+
),
|
40
|
+
el( 'p', {}, 'Hello Editor!' )
|
41
|
+
);
|
42
|
+
},
|
43
|
+
save: () => null,
|
44
|
+
} );
|
45
|
+
} )();
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test Observe Typing
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-block-api
|
8
|
+
*/
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Registers a custom script for the plugin.
|
12
|
+
*/
|
13
|
+
function enqueue_observe_typing_plugin_script() {
|
14
|
+
wp_enqueue_script(
|
15
|
+
'gutenberg-test-observe-typing',
|
16
|
+
plugins_url( 'observe-typing/index.js', __FILE__ ),
|
17
|
+
array(
|
18
|
+
'wp-blocks',
|
19
|
+
'wp-block-editor',
|
20
|
+
'wp-components',
|
21
|
+
'wp-element',
|
22
|
+
),
|
23
|
+
filemtime( plugin_dir_path( __FILE__ ) . 'observe-typing/index.js' ),
|
24
|
+
true
|
25
|
+
);
|
26
|
+
}
|
27
|
+
|
28
|
+
add_action( 'init', 'enqueue_observe_typing_plugin_script' );
|