@wordpress/e2e-tests 7.12.1-next.5a1d1283.0 → 7.13.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 +2 -0
- package/mu-plugins/enable-templates-ui.php +1 -1
- package/mu-plugins/nocache-headers.php +1 -1
- package/package.json +7 -7
- package/plugins/block-context.php +1 -1
- package/plugins/iframed-block.php +2 -2
- package/plugins/iframed-enqueue-block-assets.php +1 -1
- package/plugins/iframed-enqueue-block-editor-settings.php +1 -1
- package/plugins/iframed-inline-styles.php +3 -3
- package/plugins/iframed-masonry-block.php +2 -2
- package/plugins/iframed-multiple-stylesheets.php +2 -2
- package/plugins/inner-blocks-allowed-blocks/index.js +16 -10
- package/plugins/interactive-blocks/router-navigate/block.json +14 -0
- package/plugins/interactive-blocks/router-navigate/render.php +51 -0
- package/plugins/interactive-blocks/router-navigate/view.js +41 -0
- package/plugins/interactive-blocks.php +3 -4
- package/plugins/marquee-function-widget.php +2 -2
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
- package/specs/editor/plugins/annotations.test.js +5 -12
- package/specs/editor/plugins/container-blocks.test.js +1 -1
- package/specs/editor/plugins/custom-taxonomies.test.js +1 -1
- package/specs/editor/plugins/inner-blocks-render-appender.test.js +2 -2
- package/specs/editor/plugins/meta-boxes.test.js +2 -3
- package/specs/editor/various/__snapshots__/{reusable-blocks.test.js.snap → pattern-blocks.test.js.snap} +2 -2
- package/specs/editor/various/change-detection.test.js +1 -1
- package/specs/editor/various/inserting-blocks.test.js +2 -2
- package/specs/editor/various/{reusable-blocks.test.js → pattern-blocks.test.js} +15 -15
- package/specs/site-editor/multi-entity-saving.test.js +2 -3
- package/specs/widgets/editing-widgets.test.js +4 -6
- package/specs/performance/post-editor.test.results.json +0 -19
- package/specs/performance/site-editor.test.results.json +0 -60
package/CHANGELOG.md
CHANGED
@@ -12,7 +12,7 @@
|
|
12
12
|
// for 'networkidle'.
|
13
13
|
add_filter(
|
14
14
|
'nocache_headers',
|
15
|
-
static function( $headers ) {
|
15
|
+
static function ( $headers ) {
|
16
16
|
$cache_control_parts = explode( ', ', $headers['Cache-Control'] );
|
17
17
|
$cache_control_parts = array_diff( $cache_control_parts, array( 'no-store' ) );
|
18
18
|
$headers['Cache-Control'] = implode( ', ', $cache_control_parts );
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.13.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,11 +23,11 @@
|
|
23
23
|
"node": ">=14"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^10.
|
27
|
-
"@wordpress/jest-console": "^7.13.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^6.
|
29
|
-
"@wordpress/scripts": "^26.13.
|
30
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^10.13.0",
|
27
|
+
"@wordpress/jest-console": "^7.13.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^6.13.0",
|
29
|
+
"@wordpress/scripts": "^26.13.0",
|
30
|
+
"@wordpress/url": "^3.43.0",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
33
33
|
"filenamify": "^4.2.0",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"publishConfig": {
|
46
46
|
"access": "public"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "cc35f517ed017ab7131319af3e87c359e8de175d"
|
49
49
|
}
|
@@ -47,7 +47,7 @@ function gutenberg_test_register_context_blocks() {
|
|
47
47
|
'postId',
|
48
48
|
'postType',
|
49
49
|
),
|
50
|
-
'render_callback' => static function( $attributes, $content, $block ) {
|
50
|
+
'render_callback' => static function ( $attributes, $content, $block ) {
|
51
51
|
$ordered_context = array(
|
52
52
|
$block->context['gutenberg/recordId'],
|
53
53
|
$block->context['postId'],
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
static function() {
|
12
|
+
static function () {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
static function() {
|
19
|
+
static function () {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-block-jquery-test',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-block/jquery.test.js',
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
static function() {
|
12
|
+
static function () {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
static function() {
|
19
|
+
static function () {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-inline-styles-editor-script',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-inline-styles/editor.js',
|
@@ -40,7 +40,7 @@ add_action(
|
|
40
40
|
|
41
41
|
add_action(
|
42
42
|
'enqueue_block_editor_assets',
|
43
|
-
static function() {
|
43
|
+
static function () {
|
44
44
|
wp_enqueue_style(
|
45
45
|
'iframed-inline-styles-compat-style',
|
46
46
|
plugin_dir_url( __FILE__ ) . 'iframed-inline-styles/compat-style.css',
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
static function() {
|
12
|
+
static function () {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
static function() {
|
19
|
+
static function () {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-masonry-block-editor',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-masonry-block/editor.js',
|
@@ -9,14 +9,14 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'setup_theme',
|
12
|
-
static function() {
|
12
|
+
static function () {
|
13
13
|
add_theme_support( 'block-templates' );
|
14
14
|
}
|
15
15
|
);
|
16
16
|
|
17
17
|
add_action(
|
18
18
|
'init',
|
19
|
-
static function() {
|
19
|
+
static function () {
|
20
20
|
wp_register_script(
|
21
21
|
'iframed-multiple-stylesheets-editor-script',
|
22
22
|
plugin_dir_url( __FILE__ ) . 'iframed-multiple-stylesheets/editor.js',
|
@@ -2,14 +2,15 @@
|
|
2
2
|
const { useSelect } = wp.data;
|
3
3
|
const { registerBlockType } = wp.blocks;
|
4
4
|
const { createElement: el } = wp.element;
|
5
|
-
const { InnerBlocks } = wp.blockEditor;
|
5
|
+
const { InnerBlocks, useBlockProps } = wp.blockEditor;
|
6
6
|
const divProps = {
|
7
7
|
className: 'product',
|
8
8
|
style: { outline: '1px solid gray', padding: 5 },
|
9
9
|
};
|
10
10
|
|
11
11
|
const allowedBlocksWhenSingleEmptyChild = [ 'core/image', 'core/list' ];
|
12
|
-
const
|
12
|
+
const allowedBlocksWhenTwoChildren = [ 'core/gallery', 'core/video' ];
|
13
|
+
const allowedBlocksWhenTreeOrMoreChildren = [ 'core/gallery', 'core/video', 'core/list' ];
|
13
14
|
|
14
15
|
registerBlockType( 'test/allowed-blocks-dynamic', {
|
15
16
|
apiVersion: 3,
|
@@ -25,18 +26,23 @@
|
|
25
26
|
},
|
26
27
|
[ props.clientId ]
|
27
28
|
);
|
29
|
+
const blockProps = useBlockProps({
|
30
|
+
...divProps,
|
31
|
+
'data-number-of-children': numberOfChildren,
|
32
|
+
});
|
33
|
+
|
34
|
+
let allowedBlocks = allowedBlocksWhenSingleEmptyChild;
|
35
|
+
if ( numberOfChildren === 2 ) {
|
36
|
+
allowedBlocks = allowedBlocksWhenTwoChildren;
|
37
|
+
} else if( numberOfChildren > 2 ){
|
38
|
+
allowedBlocks = allowedBlocksWhenTreeOrMoreChildren;
|
39
|
+
}
|
28
40
|
|
29
41
|
return el(
|
30
42
|
'div',
|
31
|
-
|
32
|
-
...divProps,
|
33
|
-
'data-number-of-children': numberOfChildren,
|
34
|
-
},
|
43
|
+
blockProps,
|
35
44
|
el( InnerBlocks, {
|
36
|
-
allowedBlocks
|
37
|
-
numberOfChildren < 2
|
38
|
-
? allowedBlocksWhenSingleEmptyChild
|
39
|
-
: allowedBlocksWhenMultipleChildren,
|
45
|
+
allowedBlocks
|
40
46
|
} )
|
41
47
|
);
|
42
48
|
},
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion": 2,
|
3
|
+
"name": "test/router-navigate",
|
4
|
+
"title": "E2E Interactivity tests - router navigate",
|
5
|
+
"category": "text",
|
6
|
+
"icon": "heart",
|
7
|
+
"description": "",
|
8
|
+
"supports": {
|
9
|
+
"interactivity": true
|
10
|
+
},
|
11
|
+
"textdomain": "e2e-interactivity",
|
12
|
+
"viewScript": "router-navigate-view",
|
13
|
+
"render": "file:./render.php"
|
14
|
+
}
|
@@ -0,0 +1,51 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* HTML for testing the router navigate function.
|
4
|
+
*
|
5
|
+
* @package gutenberg-test-interactive-blocks
|
6
|
+
* @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
|
7
|
+
*/
|
8
|
+
|
9
|
+
?>
|
10
|
+
|
11
|
+
|
12
|
+
<div data-wp-interactive data-wp-navigation-id="region-1">
|
13
|
+
<h2 data-testid="title"><?php echo $attributes['title']; ?></h2>
|
14
|
+
|
15
|
+
<output
|
16
|
+
data-testid="router navigations"
|
17
|
+
data-wp-text="state.router.navigations"
|
18
|
+
>NaN</output>
|
19
|
+
<output
|
20
|
+
data-testid="router status"
|
21
|
+
data-wp-text="state.router.status"
|
22
|
+
>undefined</output>
|
23
|
+
|
24
|
+
<button
|
25
|
+
data-wp-on--click="actions.router.toggleTimeout"
|
26
|
+
data-testid="toggle timeout"
|
27
|
+
>
|
28
|
+
Timeout <span data-wp-text="state.router.timeout">NaN</span>
|
29
|
+
</button>
|
30
|
+
|
31
|
+
<?php
|
32
|
+
if ( isset( $attributes['links'] ) ) {
|
33
|
+
foreach ( $attributes['links'] as $key => $link ) {
|
34
|
+
$i = $key += 1;
|
35
|
+
echo <<<HTML
|
36
|
+
<a
|
37
|
+
data-testid="link $i"
|
38
|
+
data-wp-on--click="actions.router.navigate"
|
39
|
+
href="$link"
|
40
|
+
>link $i</a>
|
41
|
+
<a
|
42
|
+
data-testid="link $i with hash"
|
43
|
+
data-wp-on--click="actions.router.navigate"
|
44
|
+
data-force-navigation="true"
|
45
|
+
href="$link#link-$i-with-hash"
|
46
|
+
>link $i with hash</a>
|
47
|
+
HTML;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
?>
|
51
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
( ( { wp } ) => {
|
2
|
+
/**
|
3
|
+
* WordPress dependencies
|
4
|
+
*/
|
5
|
+
const { store, navigate } = wp.interactivity;
|
6
|
+
|
7
|
+
store( {
|
8
|
+
state: {
|
9
|
+
router: {
|
10
|
+
status: 'idle',
|
11
|
+
navigations: 0,
|
12
|
+
timeout: 10000,
|
13
|
+
}
|
14
|
+
},
|
15
|
+
actions: {
|
16
|
+
router: {
|
17
|
+
navigate: async ( { state, event: e } ) => {
|
18
|
+
e.preventDefault();
|
19
|
+
|
20
|
+
state.router.navigations += 1;
|
21
|
+
state.router.status = 'busy';
|
22
|
+
|
23
|
+
const force = e.target.dataset.forceNavigation === 'true';
|
24
|
+
const { timeout } = state.router;
|
25
|
+
|
26
|
+
await navigate( e.target.href, { force, timeout } );
|
27
|
+
|
28
|
+
state.router.navigations -= 1;
|
29
|
+
|
30
|
+
if ( state.router.navigations === 0) {
|
31
|
+
state.router.status = 'idle';
|
32
|
+
}
|
33
|
+
},
|
34
|
+
toggleTimeout: ( { state }) => {
|
35
|
+
state.router.timeout =
|
36
|
+
state.router.timeout === 10000 ? 0 : 10000;
|
37
|
+
}
|
38
|
+
},
|
39
|
+
},
|
40
|
+
} );
|
41
|
+
} )( window );
|
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
add_action(
|
11
11
|
'init',
|
12
|
-
function() {
|
12
|
+
function () {
|
13
13
|
// Register all blocks found in the `interactive-blocks` folder.
|
14
14
|
if ( file_exists( __DIR__ . '/interactive-blocks/' ) ) {
|
15
15
|
$block_json_files = glob( __DIR__ . '/interactive-blocks/**/block.json' );
|
@@ -30,8 +30,8 @@ add_action(
|
|
30
30
|
);
|
31
31
|
|
32
32
|
register_block_type_from_metadata( $block_folder );
|
33
|
-
}
|
34
|
-
}
|
33
|
+
}
|
34
|
+
}
|
35
35
|
|
36
36
|
// Temporary fix to disable SSR of directives during E2E testing. This
|
37
37
|
// is required at this moment, as SSR for directives is not stabilized
|
@@ -43,6 +43,5 @@ add_action(
|
|
43
43
|
'gutenberg_interactivity_process_directives_in_root_blocks'
|
44
44
|
);
|
45
45
|
}
|
46
|
-
|
47
46
|
}
|
48
47
|
);
|
@@ -14,7 +14,7 @@ function marquee_greeting_init() {
|
|
14
14
|
wp_register_sidebar_widget(
|
15
15
|
'marquee_greeting',
|
16
16
|
'Marquee Greeting',
|
17
|
-
static function() {
|
17
|
+
static function () {
|
18
18
|
$greeting = get_option( 'marquee_greeting', 'Hello!' );
|
19
19
|
printf( '<marquee>%s</marquee>', esc_html( $greeting ) );
|
20
20
|
}
|
@@ -23,7 +23,7 @@ function marquee_greeting_init() {
|
|
23
23
|
wp_register_widget_control(
|
24
24
|
'marquee_greeting',
|
25
25
|
'Marquee Greeting',
|
26
|
-
static function() {
|
26
|
+
static function () {
|
27
27
|
if ( isset( $_POST['marquee-greeting'] ) ) {
|
28
28
|
update_option(
|
29
29
|
'marquee_greeting',
|
@@ -2,6 +2,6 @@
|
|
2
2
|
|
3
3
|
exports[`Using Plugins API Document Setting Custom Panel Should render a custom panel inside Document Setting sidebar 1`] = `"My Custom Panel"`;
|
4
4
|
|
5
|
-
exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class="components-panel__header interface-complementary-area-header__small"><span class="interface-complementary-area-header__small-title">(no title)</span><button type="button" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel__header interface-complementary-area-header" tabindex="-1"><strong>Plugin title</strong><button type="button" aria-pressed="true" aria-expanded="true" class="components-button interface-complementary-area__pin-unpin-item is-pressed has-icon" aria-label="Unpin from toolbar"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"></path></svg></button><button type="button" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel"><div class="components-panel__body sidebar-title-plugin-panel is-opened"><div class="components-panel__row"><label for="title-plain-text">Title:</label><textarea class="block-editor-plain-text" id="title-plain-text" placeholder="(no title)" rows="1" style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;"></textarea></div><div class="components-panel__row"><button type="button" class="components-button is-primary">Reset</button></div></div></div>"`;
|
5
|
+
exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class="components-panel__header interface-complementary-area-header__small"><span class="interface-complementary-area-header__small-title">(no title)</span><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel__header interface-complementary-area-header" tabindex="-1"><strong>Plugin title</strong><button type="button" aria-pressed="true" aria-expanded="true" class="components-button interface-complementary-area__pin-unpin-item is-pressed has-icon" aria-label="Unpin from toolbar"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"></path></svg></button><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel"><div class="components-panel__body sidebar-title-plugin-panel is-opened"><div class="components-panel__row"><label for="title-plain-text">Title:</label><textarea class="block-editor-plain-text" id="title-plain-text" placeholder="(no title)" rows="1" style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;"></textarea></div><div class="components-panel__row"><button type="button" class="components-button is-primary">Reset</button></div></div></div>"`;
|
6
6
|
|
7
|
-
exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class="components-panel__header interface-complementary-area-header__small"><span class="interface-complementary-area-header__small-title">(no title)</span><button type="button" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel__header interface-complementary-area-header" tabindex="-1"><strong>Plugin title</strong><button type="button" aria-pressed="true" aria-expanded="true" class="components-button interface-complementary-area__pin-unpin-item is-pressed has-icon" aria-label="Unpin from toolbar"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"></path></svg></button><button type="button" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel"><div class="components-panel__body sidebar-title-plugin-panel is-opened"><div class="components-panel__row"><label for="title-plain-text">Title:</label><textarea class="block-editor-plain-text" id="title-plain-text" placeholder="(no title)" rows="1" style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;"></textarea></div><div class="components-panel__row"><button type="button" class="components-button is-primary">Reset</button></div></div></div>"`;
|
7
|
+
exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class="components-panel__header interface-complementary-area-header__small"><span class="interface-complementary-area-header__small-title">(no title)</span><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel__header interface-complementary-area-header" tabindex="-1"><strong>Plugin title</strong><button type="button" aria-pressed="true" aria-expanded="true" class="components-button interface-complementary-area__pin-unpin-item is-pressed has-icon" aria-label="Unpin from toolbar"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"></path></svg></button><button type="button" aria-controls="my-sidebar-plugin:title-sidebar" class="components-button has-icon" aria-label="Close plugin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path></svg></button></div><div class="components-panel"><div class="components-panel__body sidebar-title-plugin-panel is-opened"><div class="components-panel__row"><label for="title-plain-text">Title:</label><textarea class="block-editor-plain-text" id="title-plain-text" placeholder="(no title)" rows="1" style="overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;"></textarea></div><div class="components-panel__row"><button type="button" class="components-button is-primary">Reset</button></div></div></div>"`;
|
@@ -29,13 +29,6 @@ describe( 'Annotations', () => {
|
|
29
29
|
|
30
30
|
beforeEach( async () => {
|
31
31
|
await createNewPost();
|
32
|
-
// To do: run with iframe.
|
33
|
-
await page.evaluate( () => {
|
34
|
-
window.wp.blocks.registerBlockType( 'test/v2', {
|
35
|
-
apiVersion: '2',
|
36
|
-
title: 'test',
|
37
|
-
} );
|
38
|
-
} );
|
39
32
|
} );
|
40
33
|
|
41
34
|
/**
|
@@ -57,7 +50,7 @@ describe( 'Annotations', () => {
|
|
57
50
|
// Click add annotation button.
|
58
51
|
const addAnnotationButton = (
|
59
52
|
await page.$x( "//button[contains(text(), 'Add annotation')]" )
|
60
|
-
|
53
|
+
)[ 0 ];
|
61
54
|
await addAnnotationButton.click();
|
62
55
|
await canvas().evaluate( () =>
|
63
56
|
document.querySelector( '.wp-block-paragraph' ).focus()
|
@@ -73,7 +66,7 @@ describe( 'Annotations', () => {
|
|
73
66
|
// Click remove annotations button.
|
74
67
|
const addAnnotationButton = (
|
75
68
|
await page.$x( "//button[contains(text(), 'Remove annotations')]" )
|
76
|
-
|
69
|
+
)[ 0 ];
|
77
70
|
await addAnnotationButton.click();
|
78
71
|
await canvas().evaluate( () =>
|
79
72
|
document.querySelector( '[contenteditable]' ).focus()
|
@@ -100,7 +93,7 @@ describe( 'Annotations', () => {
|
|
100
93
|
*/
|
101
94
|
async function getRichTextInnerHTML() {
|
102
95
|
const htmlContent = await canvas().$$( '.wp-block-paragraph' );
|
103
|
-
return await
|
96
|
+
return await canvas().evaluate( ( el ) => {
|
104
97
|
return el.innerHTML;
|
105
98
|
}, htmlContent[ 0 ] );
|
106
99
|
}
|
@@ -126,7 +119,7 @@ describe( 'Annotations', () => {
|
|
126
119
|
const htmlContent = await canvas().$$(
|
127
120
|
'.block-editor-block-list__block-html-textarea'
|
128
121
|
);
|
129
|
-
const html = await
|
122
|
+
const html = await canvas().evaluate( ( el ) => {
|
130
123
|
return el.innerHTML;
|
131
124
|
}, htmlContent[ 0 ] );
|
132
125
|
|
@@ -145,7 +138,7 @@ describe( 'Annotations', () => {
|
|
145
138
|
|
146
139
|
await removeAnnotations();
|
147
140
|
const htmlContent = await canvas().$$( '.wp-block-paragraph' );
|
148
|
-
const html = await
|
141
|
+
const html = await canvas().evaluate( ( el ) => {
|
149
142
|
return el.innerHTML;
|
150
143
|
}, htmlContent[ 0 ] );
|
151
144
|
|
@@ -121,7 +121,7 @@ describe( 'Container block without paragraph support', () => {
|
|
121
121
|
// Insert an image block.
|
122
122
|
const insertButton = (
|
123
123
|
await page.$x( `//button//span[contains(text(), 'Image')]` )
|
124
|
-
|
124
|
+
)[ 0 ];
|
125
125
|
await insertButton.click();
|
126
126
|
|
127
127
|
// Check the inserted content.
|
@@ -32,7 +32,7 @@ describe( 'Custom Taxonomies labels are used', () => {
|
|
32
32
|
// Get the classes from the panel.
|
33
33
|
const buttonClassName = await (
|
34
34
|
await openButton.getProperty( 'className' )
|
35
|
-
|
35
|
+
).jsonValue();
|
36
36
|
|
37
37
|
// Open the panel if needed.
|
38
38
|
if ( -1 === buttonClassName.indexOf( 'is-opened' ) ) {
|
@@ -58,7 +58,7 @@ describe( 'RenderAppender prop of InnerBlocks', () => {
|
|
58
58
|
const inserterPopover = await page.$( INSERTER_RESULTS_SELECTOR );
|
59
59
|
const quoteButton = (
|
60
60
|
await inserterPopover.$x( QUOTE_INSERT_BUTTON_SELECTOR )
|
61
|
-
|
61
|
+
)[ 0 ];
|
62
62
|
|
63
63
|
// Insert a quote block.
|
64
64
|
await quoteButton.click();
|
@@ -93,7 +93,7 @@ describe( 'RenderAppender prop of InnerBlocks', () => {
|
|
93
93
|
const inserterPopover = await page.$( INSERTER_RESULTS_SELECTOR );
|
94
94
|
const quoteButton = (
|
95
95
|
await inserterPopover.$x( QUOTE_INSERT_BUTTON_SELECTOR )
|
96
|
-
|
96
|
+
)[ 0 ];
|
97
97
|
|
98
98
|
// Insert a quote block.
|
99
99
|
await quoteButton.click();
|
@@ -103,9 +103,8 @@ describe( 'Meta boxes', () => {
|
|
103
103
|
|
104
104
|
// Open the excerpt panel.
|
105
105
|
await openDocumentSettingsSidebar();
|
106
|
-
const excerptButton =
|
107
|
-
'Excerpt'
|
108
|
-
);
|
106
|
+
const excerptButton =
|
107
|
+
await findSidebarPanelToggleButtonWithTitle( 'Excerpt' );
|
109
108
|
if ( excerptButton ) {
|
110
109
|
await excerptButton.click( 'button' );
|
111
110
|
}
|
@@ -1,12 +1,12 @@
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
2
|
|
3
|
-
exports[`
|
3
|
+
exports[`Pattern blocks allows conversion back to blocks when the reusable block has unsaved edits 1`] = `
|
4
4
|
"<!-- wp:paragraph -->
|
5
5
|
<p>12</p>
|
6
6
|
<!-- /wp:paragraph -->"
|
7
7
|
`;
|
8
8
|
|
9
|
-
exports[`
|
9
|
+
exports[`Pattern blocks can be created from multiselection and converted back to regular blocks 1`] = `
|
10
10
|
"<!-- wp:paragraph -->
|
11
11
|
<p>Hello there!</p>
|
12
12
|
<!-- /wp:paragraph -->
|
@@ -102,7 +102,7 @@ describe( 'Change detection', () => {
|
|
102
102
|
|
103
103
|
const postPendingReviewButton = (
|
104
104
|
await page.$x( "//label[contains(text(), 'Pending review')]" )
|
105
|
-
|
105
|
+
)[ 0 ];
|
106
106
|
await postPendingReviewButton.click( 'button' );
|
107
107
|
|
108
108
|
// Force autosave to occur immediately.
|
@@ -259,7 +259,7 @@ describe( 'Inserting blocks', () => {
|
|
259
259
|
|
260
260
|
const headingButton = (
|
261
261
|
await page.$x( `//button//span[contains(text(), 'Heading')]` )
|
262
|
-
|
262
|
+
)[ 0 ];
|
263
263
|
// Hover over the block should show the blue line indicator.
|
264
264
|
await headingButton.hover();
|
265
265
|
|
@@ -354,7 +354,7 @@ describe( 'Inserting blocks', () => {
|
|
354
354
|
await openGlobalBlockInserter();
|
355
355
|
const paragraphButton = (
|
356
356
|
await page.$x( `//button//span[contains(text(), 'Paragraph')]` )
|
357
|
-
|
357
|
+
)[ 0 ];
|
358
358
|
await paragraphButton.hover();
|
359
359
|
const preview = await page.waitForSelector(
|
360
360
|
'.block-editor-inserter__preview',
|
@@ -4,7 +4,7 @@
|
|
4
4
|
import {
|
5
5
|
clickMenuItem,
|
6
6
|
insertBlock,
|
7
|
-
|
7
|
+
insertPattern,
|
8
8
|
createNewPost,
|
9
9
|
clickBlockToolbarButton,
|
10
10
|
pressKeyWithModifier,
|
@@ -19,9 +19,9 @@ import {
|
|
19
19
|
canvas,
|
20
20
|
} from '@wordpress/e2e-test-utils';
|
21
21
|
|
22
|
-
const
|
22
|
+
const patternBlockNameInputSelector =
|
23
23
|
'.patterns-menu-items__convert-modal .components-text-control__input';
|
24
|
-
const
|
24
|
+
const patternBlockInspectorNameInputSelector =
|
25
25
|
'.block-editor-block-inspector .components-text-control__input';
|
26
26
|
const syncToggleSelectorChecked =
|
27
27
|
'.patterns-menu-items__convert-modal .components-form-toggle.is-checked';
|
@@ -60,7 +60,7 @@ const clearAllBlocks = async () => {
|
|
60
60
|
} );
|
61
61
|
};
|
62
62
|
|
63
|
-
describe( '
|
63
|
+
describe( 'Pattern blocks', () => {
|
64
64
|
afterAll( async () => {
|
65
65
|
await trashAllPosts( 'wp_block' );
|
66
66
|
} );
|
@@ -74,12 +74,12 @@ describe( 'Reusable blocks', () => {
|
|
74
74
|
await clearAllBlocks();
|
75
75
|
|
76
76
|
// Insert the reusable block we created above.
|
77
|
-
await
|
77
|
+
await insertPattern( 'Greeting block' );
|
78
78
|
|
79
79
|
// Change the block's title.
|
80
80
|
await openDocumentSettingsSidebar();
|
81
81
|
const nameInput = await page.waitForSelector(
|
82
|
-
|
82
|
+
patternBlockInspectorNameInputSelector
|
83
83
|
);
|
84
84
|
await nameInput.click();
|
85
85
|
await pressKeyWithModifier( 'primary', 'a' );
|
@@ -108,7 +108,7 @@ describe( 'Reusable blocks', () => {
|
|
108
108
|
await clearAllBlocks();
|
109
109
|
|
110
110
|
// Insert the reusable block we edited above.
|
111
|
-
await
|
111
|
+
await insertPattern( 'Surprised greeting block' );
|
112
112
|
|
113
113
|
// Convert block to a regular block.
|
114
114
|
await clickBlockToolbarButton( 'Options' );
|
@@ -170,12 +170,12 @@ describe( 'Reusable blocks', () => {
|
|
170
170
|
await createNewPost();
|
171
171
|
|
172
172
|
// Step 3. Insert the block created in Step 1.
|
173
|
-
await
|
173
|
+
await insertPattern( 'Awesome block' );
|
174
174
|
|
175
175
|
// Check the title.
|
176
176
|
await openDocumentSettingsSidebar();
|
177
177
|
const title = await page.$eval(
|
178
|
-
|
178
|
+
patternBlockInspectorNameInputSelector,
|
179
179
|
( element ) => element.value
|
180
180
|
);
|
181
181
|
expect( title ).toBe( 'Awesome block' );
|
@@ -200,7 +200,7 @@ describe( 'Reusable blocks', () => {
|
|
200
200
|
|
201
201
|
// Set title.
|
202
202
|
const nameInput = await page.waitForSelector(
|
203
|
-
|
203
|
+
patternBlockNameInputSelector
|
204
204
|
);
|
205
205
|
await nameInput.click();
|
206
206
|
await page.keyboard.type( 'Multi-selection reusable block' );
|
@@ -215,7 +215,7 @@ describe( 'Reusable blocks', () => {
|
|
215
215
|
await clearAllBlocks();
|
216
216
|
|
217
217
|
// Insert the reusable block we edited above.
|
218
|
-
await
|
218
|
+
await insertPattern( 'Multi-selection reusable block' );
|
219
219
|
|
220
220
|
// Convert block to a regular block.
|
221
221
|
await clickBlockToolbarButton( 'Options' );
|
@@ -231,7 +231,7 @@ describe( 'Reusable blocks', () => {
|
|
231
231
|
'Random reusable block'
|
232
232
|
);
|
233
233
|
await clearAllBlocks();
|
234
|
-
await
|
234
|
+
await insertPattern( 'Random reusable block' );
|
235
235
|
|
236
236
|
await visitAdminPage( 'edit.php', [ 'post_type=wp_block' ] );
|
237
237
|
|
@@ -298,8 +298,8 @@ describe( 'Reusable blocks', () => {
|
|
298
298
|
'Duplicated reusable block'
|
299
299
|
);
|
300
300
|
await clearAllBlocks();
|
301
|
-
await
|
302
|
-
await
|
301
|
+
await insertPattern( 'Duplicated reusable block' );
|
302
|
+
await insertPattern( 'Duplicated reusable block' );
|
303
303
|
await saveDraft();
|
304
304
|
await page.reload();
|
305
305
|
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
|
@@ -384,7 +384,7 @@ describe( 'Reusable blocks', () => {
|
|
384
384
|
await clickBlockToolbarButton( 'Options' );
|
385
385
|
await clickMenuItem( 'Create pattern' );
|
386
386
|
const nameInput = await page.waitForSelector(
|
387
|
-
|
387
|
+
patternBlockNameInputSelector
|
388
388
|
);
|
389
389
|
await nameInput.click();
|
390
390
|
await page.keyboard.type( 'Block with styles' );
|
@@ -77,9 +77,8 @@ describe( 'Multi-entity save flow', () => {
|
|
77
77
|
|
78
78
|
// Reusable assertions inside Post editor.
|
79
79
|
const assertMultiSaveEnabled = async () => {
|
80
|
-
const multiSaveButton =
|
81
|
-
multiSaveSelector
|
82
|
-
);
|
80
|
+
const multiSaveButton =
|
81
|
+
await page.waitForSelector( multiSaveSelector );
|
83
82
|
expect( multiSaveButton ).not.toBeNull();
|
84
83
|
};
|
85
84
|
const assertMultiSaveDisabled = async () => {
|
@@ -388,9 +388,8 @@ describe( 'Widgets screen', () => {
|
|
388
388
|
name: 'Block: Widget Area',
|
389
389
|
} );
|
390
390
|
await firstWidgetArea.focus();
|
391
|
-
const marqueeBlock =
|
392
|
-
'Marquee Greeting'
|
393
|
-
);
|
391
|
+
const marqueeBlock =
|
392
|
+
await getBlockInGlobalInserter( 'Marquee Greeting' );
|
394
393
|
await marqueeBlock.click();
|
395
394
|
await page.waitForFunction(
|
396
395
|
( expectedMarquees ) => {
|
@@ -721,9 +720,8 @@ describe( 'Widgets screen', () => {
|
|
721
720
|
const [ firstWidgetArea, secondWidgetArea ] = widgetAreas;
|
722
721
|
|
723
722
|
// Insert a paragraph it should be in the first widget area.
|
724
|
-
const inserterParagraphBlock =
|
725
|
-
'Paragraph'
|
726
|
-
);
|
723
|
+
const inserterParagraphBlock =
|
724
|
+
await getBlockInGlobalInserter( 'Paragraph' );
|
727
725
|
await inserterParagraphBlock.hover();
|
728
726
|
await inserterParagraphBlock.click();
|
729
727
|
const addedParagraphBlockInFirstWidgetArea = await find(
|
@@ -1,19 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"serverResponse": [],
|
3
|
-
"firstPaint": [],
|
4
|
-
"domContentLoaded": [],
|
5
|
-
"loaded": [],
|
6
|
-
"firstContentfulPaint": [],
|
7
|
-
"firstBlock": [],
|
8
|
-
"type": [
|
9
|
-
75.483, 96.376, 82.063, 101.192, 87.573, 56.599000000000004,
|
10
|
-
63.778999999999996, 93.079, 98.277, 95.365, 94.48599999999999, 55.739,
|
11
|
-
81.715, 66.875, 60.897, 54.249, 52.537, 58.745, 49.615
|
12
|
-
],
|
13
|
-
"typeContainer": [],
|
14
|
-
"focus": [],
|
15
|
-
"listViewOpen": [],
|
16
|
-
"inserterOpen": [],
|
17
|
-
"inserterHover": [],
|
18
|
-
"inserterSearch": []
|
19
|
-
}
|
@@ -1,60 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"serverResponse": [
|
3
|
-
409.40000009536743, 405.59999990463257, 410.09999990463257
|
4
|
-
],
|
5
|
-
"firstPaint": [ 438.59999990463257, 447.3999996185303, 449.59999990463257 ],
|
6
|
-
"domContentLoaded": [ 676, 690.0999999046326, 693 ],
|
7
|
-
"loaded": [ 1405.6999998092651, 1400.3999996185303, 1425.9000000953674 ],
|
8
|
-
"firstContentfulPaint": [
|
9
|
-
903.2999997138977, 921.0999999046326, 925.2999997138977
|
10
|
-
],
|
11
|
-
"firstBlock": [
|
12
|
-
3166.7999997138977, 3206.5999999046326, 3238.4000000953674
|
13
|
-
],
|
14
|
-
"type": [
|
15
|
-
81.45900000000002, 37.088, 36.051, 38.596000000000004, 49.931, 40.322,
|
16
|
-
38.99999999999999, 34.235, 33.608999999999995, 32.88399999999999, 30.44,
|
17
|
-
37.113, 31.534999999999997, 33.792, 36.942, 35.251000000000005, 33.722,
|
18
|
-
33.471999999999994, 35.26499999999999, 29.682, 30.173,
|
19
|
-
30.674999999999997, 35.668000000000006, 38.278, 37.62, 37.562, 38.091,
|
20
|
-
32.237, 28.119999999999997, 31.342, 39.89, 37.443, 37.761, 40.262,
|
21
|
-
37.922, 30.727, 30.955000000000002, 36.53000000000001, 32.293, 37.299,
|
22
|
-
38.55800000000001, 39.85699999999999, 33.721999999999994, 30.139,
|
23
|
-
29.294, 31.016, 35.7, 36.839, 31.061000000000003, 29.540000000000003,
|
24
|
-
48.998999999999995, 35.423, 33.650000000000006, 29.404999999999998,
|
25
|
-
32.744, 30.584999999999997, 30.705, 31.873, 28.907, 30.516, 30.882,
|
26
|
-
29.257, 29.794, 31.150000000000002, 32.095, 31.066000000000003, 32.872,
|
27
|
-
31.894, 31.331, 31.796, 31.675, 30.427999999999997, 30.872, 30.974,
|
28
|
-
32.707, 31.849999999999998, 28.935, 28.441000000000003,
|
29
|
-
30.566000000000003, 29.014, 33.158, 32.272, 28.990000000000002, 28.76,
|
30
|
-
28.967000000000002, 29.418, 28.503, 31.255000000000003, 28.703,
|
31
|
-
30.369000000000003, 34.910000000000004, 31.03, 28.523,
|
32
|
-
32.361999999999995, 33.870000000000005, 30.11, 30.944000000000003,
|
33
|
-
28.601, 30.572999999999997, 33.216, 30.822, 28.892000000000003,
|
34
|
-
32.95099999999999, 31.228, 28.251, 34.89, 30.131000000000004, 29.395,
|
35
|
-
31.557000000000002, 28.137, 32.051, 38.242, 36.382999999999996, 35.037,
|
36
|
-
36.2, 31.717999999999996, 28.927999999999997, 32.540000000000006,
|
37
|
-
35.448, 28.292, 35.059999999999995, 31.345000000000002, 36.122, 31.69,
|
38
|
-
28.492, 29.308, 30.793000000000003, 28.784000000000002,
|
39
|
-
28.275999999999996, 36.577999999999996, 30.220000000000002, 35.832,
|
40
|
-
31.192, 36.102999999999994, 30.733999999999998, 30.574,
|
41
|
-
35.455999999999996, 29.963, 37.967, 29.323999999999998, 36.643,
|
42
|
-
31.200000000000003, 36.864999999999995, 32.344, 30.321, 29.214, 28.627,
|
43
|
-
29.71, 29.006, 36.067, 29.583, 29.562, 37.795, 30.166999999999998,
|
44
|
-
30.811999999999998, 33.319, 32.939, 39.233999999999995, 28.856,
|
45
|
-
34.81700000000001, 30.324, 33.611000000000004, 33.707,
|
46
|
-
30.191000000000003, 29.191, 29.23, 30.715, 29.281, 28.168,
|
47
|
-
33.449000000000005, 36.36600000000001, 29.086, 30.589, 29.13, 28.789,
|
48
|
-
29.156000000000002, 43.327, 34.439, 28.777, 30.586, 28.973000000000003,
|
49
|
-
30.026, 40.023, 30.203, 28.328000000000003, 30.825000000000003, 29.739,
|
50
|
-
31.504, 43.708000000000006, 29.296999999999997, 32.294, 31.733, 30.44,
|
51
|
-
28.879, 30.349999999999998, 29.466, 29.302999999999997, 30,
|
52
|
-
29.468999999999998, 28.740000000000002
|
53
|
-
],
|
54
|
-
"typeContainer": [],
|
55
|
-
"focus": [],
|
56
|
-
"inserterOpen": [],
|
57
|
-
"inserterHover": [],
|
58
|
-
"inserterSearch": [],
|
59
|
-
"listViewOpen": []
|
60
|
-
}
|