@wordpress/e2e-tests 7.12.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/editor/various/__snapshots__/rich-text.test.js.snap +0 -231
- package/specs/editor/various/rich-text.test.js +0 -570
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.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^6.
|
29
|
-
"@wordpress/scripts": "^26.
|
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',
|