@wordpress/e2e-tests 7.7.0 → 7.9.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 +7 -7
- package/plugins/block-api/index.js +5 -2
- package/plugins/block-api.php +2 -0
- package/plugins/block-context.php +9 -13
- package/plugins/deprecated-node-matcher/index.js +12 -16
- package/plugins/deprecated-node-matcher.php +0 -1
- package/plugins/iframed-enqueue-block-assets/script.js +3 -0
- package/plugins/iframed-enqueue-block-assets.php +13 -0
- package/plugins/inner-blocks-allowed-blocks/index.js +1 -0
- package/plugins/inner-blocks-templates/index.js +33 -30
- package/plugins/interactive-blocks/directive-bind/block.json +14 -0
- package/plugins/interactive-blocks/directive-bind/render.php +59 -0
- package/plugins/interactive-blocks/directive-bind/view.js +23 -0
- package/plugins/interactive-blocks/directive-class/block.json +14 -0
- package/plugins/interactive-blocks/directive-class/render.php +75 -0
- package/plugins/interactive-blocks/directive-class/view.js +21 -0
- package/plugins/interactive-blocks/directive-context/block.json +14 -0
- package/plugins/interactive-blocks/directive-context/render.php +121 -0
- package/plugins/interactive-blocks/directive-context/view.js +22 -0
- package/plugins/interactive-blocks/directive-effect/block.json +14 -0
- package/plugins/interactive-blocks/directive-effect/render.php +27 -0
- package/plugins/interactive-blocks/directive-effect/view.js +61 -0
- package/plugins/interactive-blocks/directive-priorities/block.json +14 -0
- package/plugins/interactive-blocks/directive-priorities/render.php +20 -0
- package/plugins/interactive-blocks/directive-priorities/view.js +121 -0
- package/plugins/interactive-blocks/directive-show/block.json +14 -0
- package/plugins/interactive-blocks/directive-show/render.php +53 -0
- package/plugins/interactive-blocks/directive-show/view.js +24 -0
- package/plugins/interactive-blocks/directive-style/block.json +14 -0
- package/plugins/interactive-blocks/directive-style/render.php +93 -0
- package/plugins/interactive-blocks/directive-style/view.js +22 -0
- package/plugins/interactive-blocks/directive-text/block.json +14 -0
- package/plugins/interactive-blocks/directive-text/render.php +35 -0
- package/plugins/interactive-blocks/directive-text/view.js +17 -0
- package/plugins/interactive-blocks/negation-operator/block.json +14 -0
- package/plugins/interactive-blocks/negation-operator/render.php +26 -0
- package/plugins/interactive-blocks/negation-operator/view.js +22 -0
- package/plugins/interactive-blocks/store-tag/block.json +14 -0
- package/plugins/interactive-blocks/store-tag/render.php +64 -0
- package/plugins/interactive-blocks/store-tag/view.js +24 -0
- package/plugins/interactive-blocks/tovdom/block.json +14 -0
- package/plugins/interactive-blocks/tovdom/cdata.js +15 -0
- package/plugins/interactive-blocks/tovdom/processing-instructions.js +16 -0
- package/plugins/interactive-blocks/tovdom/render.php +33 -0
- package/plugins/interactive-blocks/tovdom/view.js +5 -0
- package/plugins/interactive-blocks/tovdom-islands/block.json +14 -0
- package/plugins/interactive-blocks/tovdom-islands/render.php +66 -0
- package/plugins/interactive-blocks/tovdom-islands/view.js +9 -0
- package/plugins/interactive-blocks.php +48 -0
- package/specs/editor/plugins/__snapshots__/container-blocks.test.js.snap +5 -4
- package/specs/editor/plugins/container-blocks.test.js +2 -1
- package/specs/editor/plugins/iframed-equeue-block-assets.test.js +7 -0
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +1 -1
- package/specs/editor/various/links.test.js +18 -11
- package/specs/editor/various/publish-button.test.js +0 -15
- package/specs/editor/various/reusable-blocks.test.js +7 -13
- package/specs/experiments/blocks/post-comments-form.test.js +1 -1
- package/specs/site-editor/multi-entity-saving.test.js +0 -102
- package/specs/site-editor/settings-sidebar.test.js +1 -1
- package/specs/editor/various/adding-inline-tokens.test.js +0 -80
@@ -0,0 +1,17 @@
|
|
1
|
+
( ( { wp } ) => {
|
2
|
+
const { store } = wp.interactivity;
|
3
|
+
|
4
|
+
store( {
|
5
|
+
state: {
|
6
|
+
text: 'Text 1',
|
7
|
+
},
|
8
|
+
actions: {
|
9
|
+
toggleStateText: ( { state } ) => {
|
10
|
+
state.text = state.text === 'Text 1' ? 'Text 2' : 'Text 1';
|
11
|
+
},
|
12
|
+
toggleContextText: ( { context } ) => {
|
13
|
+
context.text = context.text === 'Text 1' ? 'Text 2' : 'Text 1';
|
14
|
+
},
|
15
|
+
},
|
16
|
+
} );
|
17
|
+
} )( window );
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion": 2,
|
3
|
+
"name": "test/negation-operator",
|
4
|
+
"title": "E2E Interactivity tests - negation operator",
|
5
|
+
"category": "text",
|
6
|
+
"icon": "heart",
|
7
|
+
"description": "",
|
8
|
+
"supports": {
|
9
|
+
"interactivity": true
|
10
|
+
},
|
11
|
+
"textdomain": "e2e-interactivity",
|
12
|
+
"viewScript": "negation-operator-view",
|
13
|
+
"render": "file:./render.php"
|
14
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* HTML for testing the negation operator in directives.
|
4
|
+
*
|
5
|
+
* @package gutenberg-test-interactive-blocks
|
6
|
+
*/
|
7
|
+
|
8
|
+
?>
|
9
|
+
<div data-wp-interactive>
|
10
|
+
<button
|
11
|
+
data-wp-on--click="actions.toggle"
|
12
|
+
data-testid="toggle active value"
|
13
|
+
>
|
14
|
+
Toggle Active Value
|
15
|
+
</button>
|
16
|
+
|
17
|
+
<div
|
18
|
+
data-wp-bind--hidden="!state.active"
|
19
|
+
data-testid="add hidden attribute if state is not active"
|
20
|
+
></div>
|
21
|
+
|
22
|
+
<div
|
23
|
+
data-wp-bind--hidden="!selectors.active"
|
24
|
+
data-testid="add hidden attribute if selector is not active"
|
25
|
+
></div>
|
26
|
+
</div>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
( ( { wp } ) => {
|
2
|
+
/**
|
3
|
+
* WordPress dependencies
|
4
|
+
*/
|
5
|
+
const { store } = wp.interactivity;
|
6
|
+
|
7
|
+
store( {
|
8
|
+
selectors: {
|
9
|
+
active: ( { state } ) => {
|
10
|
+
return state.active;
|
11
|
+
},
|
12
|
+
},
|
13
|
+
state: {
|
14
|
+
active: false,
|
15
|
+
},
|
16
|
+
actions: {
|
17
|
+
toggle: ( { state } ) => {
|
18
|
+
state.active = ! state.active;
|
19
|
+
},
|
20
|
+
},
|
21
|
+
} );
|
22
|
+
} )( window );
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion": 2,
|
3
|
+
"name": "test/store-tag",
|
4
|
+
"title": "E2E Interactivity tests - store tag",
|
5
|
+
"category": "text",
|
6
|
+
"icon": "heart",
|
7
|
+
"description": "",
|
8
|
+
"supports": {
|
9
|
+
"interactivity": true
|
10
|
+
},
|
11
|
+
"textdomain": "e2e-interactivity",
|
12
|
+
"viewScript": "store-tag-view",
|
13
|
+
"render": "file:./render.php"
|
14
|
+
}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* HTML for testing the hydration of the serialized store.
|
4
|
+
*
|
5
|
+
* @package gutenberg-test-interactive-blocks
|
6
|
+
* @phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable
|
7
|
+
*/
|
8
|
+
|
9
|
+
// These variables simulates SSR.
|
10
|
+
$test_store_tag_counter = 'ok' === $attributes['condition'] ? 3 : 0;
|
11
|
+
$test_store_tag_double = $test_store_tag_counter * 2;
|
12
|
+
?>
|
13
|
+
<div data-wp-interactive>
|
14
|
+
<div>
|
15
|
+
Counter:
|
16
|
+
<span
|
17
|
+
data-wp-bind--children="state.counter.value"
|
18
|
+
data-testid="counter value"
|
19
|
+
><?php echo $test_store_tag_counter; ?></span
|
20
|
+
>
|
21
|
+
<br />
|
22
|
+
Double:
|
23
|
+
<span
|
24
|
+
data-wp-bind--children="state.counter.double"
|
25
|
+
data-testid="counter double"
|
26
|
+
><?php echo $test_store_tag_double; ?></span
|
27
|
+
>
|
28
|
+
<br />
|
29
|
+
<button
|
30
|
+
data-wp-on--click="actions.counter.increment"
|
31
|
+
data-testid="counter button"
|
32
|
+
>
|
33
|
+
+1
|
34
|
+
</button>
|
35
|
+
<span
|
36
|
+
data-wp-bind--children="state.counter.clicks"
|
37
|
+
data-testid="counter clicks"
|
38
|
+
>0</span
|
39
|
+
>
|
40
|
+
clicks
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
<?php
|
44
|
+
|
45
|
+
if ( 'missing' !== $attributes['condition'] ) {
|
46
|
+
|
47
|
+
if ( 'ok' === $attributes['condition'] ) {
|
48
|
+
$test_store_tag_json = '{ "state": { "counter": { "value": 3 } } }';
|
49
|
+
}
|
50
|
+
|
51
|
+
if ( 'corrupted-json' === $attributes['condition'] ) {
|
52
|
+
$test_store_tag_json = 'this is not a JSON';
|
53
|
+
}
|
54
|
+
|
55
|
+
if ( 'invalid-state' === $attributes['condition'] ) {
|
56
|
+
$test_store_tag_json = '{ "state": null }';
|
57
|
+
}
|
58
|
+
|
59
|
+
echo <<<HTML
|
60
|
+
<script type="application/json" id="wp-interactivity-store-data">
|
61
|
+
$test_store_tag_json
|
62
|
+
</script>
|
63
|
+
HTML;
|
64
|
+
}
|
@@ -0,0 +1,24 @@
|
|
1
|
+
( ( { wp } ) => {
|
2
|
+
/**
|
3
|
+
* WordPress dependencies
|
4
|
+
*/
|
5
|
+
const { store } = wp.interactivity;
|
6
|
+
|
7
|
+
store( {
|
8
|
+
state: {
|
9
|
+
counter: {
|
10
|
+
// `value` is defined in the server.
|
11
|
+
double: ( { state } ) => state.counter.value * 2,
|
12
|
+
clicks: 0,
|
13
|
+
},
|
14
|
+
},
|
15
|
+
actions: {
|
16
|
+
counter: {
|
17
|
+
increment: ( { state } ) => {
|
18
|
+
state.counter.value += 1;
|
19
|
+
state.counter.clicks += 1;
|
20
|
+
},
|
21
|
+
},
|
22
|
+
},
|
23
|
+
} );
|
24
|
+
} )( window );
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion": 2,
|
3
|
+
"name": "test/tovdom",
|
4
|
+
"title": "E2E Interactivity tests - tovdom",
|
5
|
+
"category": "text",
|
6
|
+
"icon": "heart",
|
7
|
+
"description": "",
|
8
|
+
"supports": {
|
9
|
+
"interactivity": true
|
10
|
+
},
|
11
|
+
"textdomain": "e2e-interactivity",
|
12
|
+
"viewScript": "tovdom-view",
|
13
|
+
"render": "file:./render.php"
|
14
|
+
}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
const cdata = `
|
2
|
+
<div>
|
3
|
+
<![CDATA[##1##]]>
|
4
|
+
<div data-testid="it should keep this node between CDATA">
|
5
|
+
<![CDATA[##2##]]>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
`;
|
9
|
+
|
10
|
+
const cdataElement = new DOMParser()
|
11
|
+
.parseFromString( cdata, 'text/xml' )
|
12
|
+
.querySelector( 'div' );
|
13
|
+
document
|
14
|
+
.getElementById( 'replace-with-cdata' )
|
15
|
+
.replaceWith( cdataElement );
|
@@ -0,0 +1,16 @@
|
|
1
|
+
const processingInstructions = `
|
2
|
+
<div>
|
3
|
+
<?xpacket ##1## ?>
|
4
|
+
<div data-testid="it should keep this node between processing instructions">
|
5
|
+
Processing instructions inner node
|
6
|
+
<?xpacket ##2## ?>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
`;
|
10
|
+
|
11
|
+
const processingInstructionsElement = new DOMParser()
|
12
|
+
.parseFromString( processingInstructions, 'text/xml' )
|
13
|
+
.querySelector( 'div' );
|
14
|
+
document
|
15
|
+
.getElementById( 'replace-with-processing-instructions' )
|
16
|
+
.replaceWith( processingInstructionsElement );
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* HTML for testing the vDOM generation.
|
4
|
+
*
|
5
|
+
* @package gutenberg-test-interactive-blocks
|
6
|
+
*/
|
7
|
+
|
8
|
+
$plugin_url = plugin_dir_url( __DIR__ );
|
9
|
+
$src_proc_ins = $plugin_url . 'tovdom/processing-instructions.js';
|
10
|
+
$src_cdata = $plugin_url . 'tovdom/cdata.js';
|
11
|
+
?>
|
12
|
+
|
13
|
+
<div data-wp-interactive>
|
14
|
+
<div data-testid="it should delete comments">
|
15
|
+
<!-- ##1## -->
|
16
|
+
<div data-testid="it should keep this node between comments">
|
17
|
+
Comments inner node
|
18
|
+
<!-- ##2## -->
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div data-testid="it should delete processing instructions">
|
23
|
+
<div id="replace-with-processing-instructions"></div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<script src="<?php echo $src_proc_ins; ?>"></script>
|
27
|
+
|
28
|
+
<div data-testid="it should replace CDATA with text nodes">
|
29
|
+
<div id="replace-with-cdata"></div>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<script src="<?php echo $src_cdata; ?>"></script>
|
33
|
+
</div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"apiVersion": 2,
|
3
|
+
"name": "test/tovdom-islands",
|
4
|
+
"title": "E2E Interactivity tests - tovdom islands",
|
5
|
+
"category": "text",
|
6
|
+
"icon": "heart",
|
7
|
+
"description": "",
|
8
|
+
"supports": {
|
9
|
+
"interactivity": true
|
10
|
+
},
|
11
|
+
"textdomain": "e2e-interactivity",
|
12
|
+
"viewScript": "tovdom-islands-view",
|
13
|
+
"render": "file:./render.php"
|
14
|
+
}
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* HTML for testing the directive `data-wp-interactive`.
|
4
|
+
*
|
5
|
+
* @package gutenberg-test-interactive-blocks
|
6
|
+
*/
|
7
|
+
|
8
|
+
?>
|
9
|
+
<div>
|
10
|
+
<div data-wp-show="state.falseValue">
|
11
|
+
<span data-testid="not inside an island">
|
12
|
+
This should be shown because it is inside an island.
|
13
|
+
</span>
|
14
|
+
</div>
|
15
|
+
|
16
|
+
<div data-wp-interactive>
|
17
|
+
<div data-wp-show="state.falseValue">
|
18
|
+
<span data-testid="inside an island">
|
19
|
+
This should not be shown because it is inside an island.
|
20
|
+
</span>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div data-wp-interactive>
|
25
|
+
<div data-wp-ignore>
|
26
|
+
<div data-wp-show="state.falseValue">
|
27
|
+
<span
|
28
|
+
data-testid="inside an inner block of an isolated island"
|
29
|
+
>
|
30
|
+
This should be shown because it is inside an inner
|
31
|
+
block of an isolated island.
|
32
|
+
</span>
|
33
|
+
</div>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
|
37
|
+
<div data-wp-interactive>
|
38
|
+
<div data-wp-interactive>
|
39
|
+
<div
|
40
|
+
data-wp-show="state.falseValue"
|
41
|
+
data-testid="island inside another island"
|
42
|
+
>
|
43
|
+
<span>
|
44
|
+
This should not have two template wrappers because
|
45
|
+
that means we hydrated twice.
|
46
|
+
</span>
|
47
|
+
</div>
|
48
|
+
</div>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div data-wp-interactive>
|
52
|
+
<div>
|
53
|
+
<div data-wp-interactive data-wp-ignore>
|
54
|
+
<div data-wp-show="state.falseValue">
|
55
|
+
<span
|
56
|
+
data-testid="island inside inner block of isolated island"
|
57
|
+
>
|
58
|
+
This should not be shown because even though it
|
59
|
+
is inside an inner block of an isolated island,
|
60
|
+
it's inside an new island.
|
61
|
+
</span>
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
</div>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<?php
|
2
|
+
/**
|
3
|
+
* Plugin Name: Gutenberg Test Interactive Blocks
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
5
|
+
* Author: Gutenberg Team
|
6
|
+
*
|
7
|
+
* @package gutenberg-test-interactive-blocks
|
8
|
+
*/
|
9
|
+
|
10
|
+
add_action(
|
11
|
+
'init',
|
12
|
+
function() {
|
13
|
+
// Register all blocks found in the `interactive-blocks` folder.
|
14
|
+
if ( file_exists( __DIR__ . '/interactive-blocks/' ) ) {
|
15
|
+
$block_json_files = glob( __DIR__ . '/interactive-blocks/**/block.json' );
|
16
|
+
|
17
|
+
// Auto register all blocks that were found.
|
18
|
+
foreach ( $block_json_files as $filename ) {
|
19
|
+
$block_folder = dirname( $filename );
|
20
|
+
$name = basename( $block_folder );
|
21
|
+
|
22
|
+
$view_file = plugin_dir_url( $block_folder ) . $name . '/' . 'view.js';
|
23
|
+
|
24
|
+
wp_register_script(
|
25
|
+
$name . '-view',
|
26
|
+
$view_file,
|
27
|
+
array( 'wp-interactivity' ),
|
28
|
+
filemtime( $view_file ),
|
29
|
+
true
|
30
|
+
);
|
31
|
+
|
32
|
+
register_block_type_from_metadata( $block_folder );
|
33
|
+
};
|
34
|
+
};
|
35
|
+
|
36
|
+
// Temporary fix to disable SSR of directives during E2E testing. This
|
37
|
+
// is required at this moment, as SSR for directives is not stabilized
|
38
|
+
// yet and we need to ensure hydration works, even when the rendered
|
39
|
+
// HTML is not correct or malformed.
|
40
|
+
if ( 'true' === $_GET['disable_directives_ssr'] ) {
|
41
|
+
remove_filter(
|
42
|
+
'render_block',
|
43
|
+
'gutenberg_interactivity_process_directives_in_root_blocks'
|
44
|
+
);
|
45
|
+
}
|
46
|
+
|
47
|
+
}
|
48
|
+
);
|
@@ -22,10 +22,11 @@ exports[`InnerBlocks Template Sync Ensures blocks without locking are kept intac
|
|
22
22
|
<p class="has-large-font-size">Content…</p>
|
23
23
|
<!-- /wp:paragraph -->
|
24
24
|
|
25
|
-
<!-- wp:paragraph -->
|
26
|
-
<p>added paragraph</p>
|
27
|
-
<!-- /wp:paragraph -->
|
28
|
-
<!-- /wp:test/test-inner-blocks-no-locking -->
|
25
|
+
<!-- wp:paragraph -->
|
26
|
+
<p>added paragraph</p>
|
27
|
+
<!-- /wp:paragraph -->
|
28
|
+
<!-- /wp:test/test-inner-blocks-no-locking -->
|
29
|
+
"
|
29
30
|
`;
|
30
31
|
|
31
32
|
exports[`InnerBlocks Template Sync Removes blocks that are not expected by the template if a lock all exists 1`] = `
|
@@ -9,6 +9,7 @@ import {
|
|
9
9
|
insertBlock,
|
10
10
|
switchEditorModeTo,
|
11
11
|
pressKeyWithModifier,
|
12
|
+
canvas,
|
12
13
|
} from '@wordpress/e2e-test-utils';
|
13
14
|
|
14
15
|
describe( 'InnerBlocks Template Sync', () => {
|
@@ -75,7 +76,7 @@ describe( 'InnerBlocks Template Sync', () => {
|
|
75
76
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
76
77
|
|
77
78
|
// Trigger a template update and assert that a second block is now present.
|
78
|
-
const [ button ] = await
|
79
|
+
const [ button ] = await canvas().$x(
|
79
80
|
`//button[contains(text(), 'Update template')]`
|
80
81
|
);
|
81
82
|
await button.click();
|
@@ -32,6 +32,7 @@ describe( 'iframed inline styles', () => {
|
|
32
32
|
} );
|
33
33
|
|
34
34
|
it( 'should load styles added through enqueue_block_assets', async () => {
|
35
|
+
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
|
35
36
|
// Check stylesheet.
|
36
37
|
expect(
|
37
38
|
await getComputedStyle( canvas(), 'body', 'background-color' )
|
@@ -40,5 +41,11 @@ describe( 'iframed inline styles', () => {
|
|
40
41
|
expect( await getComputedStyle( canvas(), 'body', 'padding' ) ).toBe(
|
41
42
|
'20px'
|
42
43
|
);
|
44
|
+
|
45
|
+
expect(
|
46
|
+
await canvas().evaluate( () => ( { ...document.body.dataset } ) )
|
47
|
+
).toEqual( {
|
48
|
+
iframedEnqueueBlockAssetsL10n: 'Iframed Enqueue Block Assets!',
|
49
|
+
} );
|
43
50
|
} );
|
44
51
|
} );
|
@@ -90,7 +90,7 @@ describe( 'block editor keyboard shortcuts', () => {
|
|
90
90
|
} );
|
91
91
|
it( 'should prevent deleting multiple selected blocks from inputs', async () => {
|
92
92
|
await clickBlockToolbarButton( 'Options' );
|
93
|
-
await clickMenuItem( 'Create pattern' );
|
93
|
+
await clickMenuItem( 'Create pattern/reusable block' );
|
94
94
|
const reusableBlockNameInputSelector =
|
95
95
|
'.reusable-blocks-menu-items__convert-modal .components-text-control__input';
|
96
96
|
const nameInput = await page.waitForSelector(
|
@@ -105,7 +105,8 @@ describe( 'Links', () => {
|
|
105
105
|
await waitForURLFieldAutoFocus();
|
106
106
|
|
107
107
|
const urlInputValue = await page.evaluate(
|
108
|
-
() =>
|
108
|
+
() =>
|
109
|
+
document.querySelector( '.block-editor-url-input__input' ).value
|
109
110
|
);
|
110
111
|
|
111
112
|
expect( urlInputValue ).toBe( '' );
|
@@ -496,7 +497,7 @@ describe( 'Links', () => {
|
|
496
497
|
await pressKeyWithModifier( 'primary', 'K' );
|
497
498
|
|
498
499
|
const [ settingsToggle ] = await page.$x(
|
499
|
-
'//button[contains(
|
500
|
+
'//button[contains(text(), "Advanced")]'
|
500
501
|
);
|
501
502
|
await settingsToggle.click();
|
502
503
|
|
@@ -528,7 +529,7 @@ describe( 'Links', () => {
|
|
528
529
|
|
529
530
|
await waitForURLFieldAutoFocus();
|
530
531
|
|
531
|
-
await
|
532
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
532
533
|
|
533
534
|
// Tabbing should land us in the text input.
|
534
535
|
const { isTextInput, textValue } = await page.evaluate( () => {
|
@@ -585,8 +586,10 @@ describe( 'Links', () => {
|
|
585
586
|
|
586
587
|
await editButton.click();
|
587
588
|
|
588
|
-
|
589
|
-
|
589
|
+
await waitForURLFieldAutoFocus();
|
590
|
+
|
591
|
+
// Tabbing backward should land us in the "Text" input.
|
592
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
590
593
|
|
591
594
|
const textInputValue = await page.evaluate(
|
592
595
|
() => document.activeElement.value
|
@@ -614,8 +617,9 @@ describe( 'Links', () => {
|
|
614
617
|
);
|
615
618
|
await editButton.click();
|
616
619
|
|
617
|
-
|
618
|
-
|
620
|
+
await waitForURLFieldAutoFocus();
|
621
|
+
|
622
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
619
623
|
|
620
624
|
const textInputValue = await page.evaluate(
|
621
625
|
() => document.activeElement.value
|
@@ -661,7 +665,7 @@ describe( 'Links', () => {
|
|
661
665
|
await waitForURLFieldAutoFocus();
|
662
666
|
|
663
667
|
const [ settingsToggle ] = await page.$x(
|
664
|
-
'//button[contains(
|
668
|
+
'//button[contains(text(), "Advanced")]'
|
665
669
|
);
|
666
670
|
await settingsToggle.click();
|
667
671
|
|
@@ -679,7 +683,7 @@ describe( 'Links', () => {
|
|
679
683
|
await pressKeyWithModifier( 'shift', 'ArrowRight' );
|
680
684
|
|
681
685
|
// Move back to the text input.
|
682
|
-
await pressKeyTimes( 'Tab',
|
686
|
+
await pressKeyTimes( 'Tab', 1 );
|
683
687
|
|
684
688
|
// Tabbing back should land us in the text input.
|
685
689
|
const textInputValue = await page.evaluate(
|
@@ -879,8 +883,11 @@ describe( 'Links', () => {
|
|
879
883
|
|
880
884
|
await waitForURLFieldAutoFocus();
|
881
885
|
|
882
|
-
// Move to
|
883
|
-
await
|
886
|
+
// Move to "Text" field.
|
887
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
888
|
+
|
889
|
+
// Delete existing value from "Text" field
|
890
|
+
await page.keyboard.press( 'Delete' );
|
884
891
|
|
885
892
|
// Change text to "z"
|
886
893
|
await page.keyboard.type( 'z' );
|
@@ -43,19 +43,4 @@ describe( 'PostPublishButton', () => {
|
|
43
43
|
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
44
44
|
).not.toBeNull();
|
45
45
|
} );
|
46
|
-
|
47
|
-
it( 'should be disabled when metabox is being saved', async () => {
|
48
|
-
await canvas().type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable.
|
49
|
-
expect(
|
50
|
-
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
51
|
-
).toBeNull();
|
52
|
-
|
53
|
-
await page.evaluate( () => {
|
54
|
-
window.wp.data.dispatch( 'core/edit-post' ).requestMetaBoxUpdates();
|
55
|
-
return true;
|
56
|
-
} );
|
57
|
-
expect(
|
58
|
-
await page.$( '.editor-post-publish-button[aria-disabled="true"]' )
|
59
|
-
).not.toBeNull();
|
60
|
-
} );
|
61
46
|
} );
|
@@ -23,8 +23,6 @@ const reusableBlockNameInputSelector =
|
|
23
23
|
'.reusable-blocks-menu-items__convert-modal .components-text-control__input';
|
24
24
|
const reusableBlockInspectorNameInputSelector =
|
25
25
|
'.block-editor-block-inspector .components-text-control__input';
|
26
|
-
const syncToggleSelector =
|
27
|
-
'.reusable-blocks-menu-items__convert-modal .components-form-toggle__input';
|
28
26
|
const syncToggleSelectorChecked =
|
29
27
|
'.reusable-blocks-menu-items__convert-modal .components-form-toggle.is-checked';
|
30
28
|
|
@@ -113,7 +111,7 @@ describe( 'Reusable blocks', () => {
|
|
113
111
|
await insertReusableBlock( 'Surprised greeting block' );
|
114
112
|
|
115
113
|
// Convert block to a regular block.
|
116
|
-
await clickBlockToolbarButton( '
|
114
|
+
await clickBlockToolbarButton( 'Detach pattern' );
|
117
115
|
|
118
116
|
// Check that we have a paragraph block on the page.
|
119
117
|
const paragraphBlock = await canvas().$(
|
@@ -197,7 +195,7 @@ describe( 'Reusable blocks', () => {
|
|
197
195
|
|
198
196
|
// Convert block to a reusable block.
|
199
197
|
await clickBlockToolbarButton( 'Options' );
|
200
|
-
await clickMenuItem( 'Create pattern' );
|
198
|
+
await clickMenuItem( 'Create pattern/reusable block' );
|
201
199
|
|
202
200
|
// Set title.
|
203
201
|
const nameInput = await page.waitForSelector(
|
@@ -205,14 +203,12 @@ describe( 'Reusable blocks', () => {
|
|
205
203
|
);
|
206
204
|
await nameInput.click();
|
207
205
|
await page.keyboard.type( 'Multi-selection reusable block' );
|
208
|
-
const syncToggle = await page.waitForSelector( syncToggleSelector );
|
209
|
-
syncToggle.click();
|
210
206
|
await page.waitForSelector( syncToggleSelectorChecked );
|
211
207
|
await page.keyboard.press( 'Enter' );
|
212
208
|
|
213
209
|
// Wait for creation to finish.
|
214
210
|
await page.waitForXPath(
|
215
|
-
'//*[contains(@class, "components-snackbar")]/*[text()
|
211
|
+
'//*[contains(@class, "components-snackbar")]/*[contains(text(),"Pattern created:")]'
|
216
212
|
);
|
217
213
|
|
218
214
|
await clearAllBlocks();
|
@@ -221,7 +217,7 @@ describe( 'Reusable blocks', () => {
|
|
221
217
|
await insertReusableBlock( 'Multi-selection reusable block' );
|
222
218
|
|
223
219
|
// Convert block to a regular block.
|
224
|
-
await clickBlockToolbarButton( '
|
220
|
+
await clickBlockToolbarButton( 'Detach patterns' );
|
225
221
|
|
226
222
|
// Check that we have two paragraph blocks on the page.
|
227
223
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
@@ -352,8 +348,8 @@ describe( 'Reusable blocks', () => {
|
|
352
348
|
expect( reusableBlockWithParagraph ).toBeTruthy();
|
353
349
|
|
354
350
|
// Convert back to regular blocks.
|
355
|
-
await clickBlockToolbarButton( 'Select
|
356
|
-
await clickBlockToolbarButton( '
|
351
|
+
await clickBlockToolbarButton( 'Select Edited block' );
|
352
|
+
await clickBlockToolbarButton( 'Detach pattern' );
|
357
353
|
await page.waitForXPath( selector, {
|
358
354
|
hidden: true,
|
359
355
|
} );
|
@@ -383,14 +379,12 @@ describe( 'Reusable blocks', () => {
|
|
383
379
|
|
384
380
|
// Convert to reusable.
|
385
381
|
await clickBlockToolbarButton( 'Options' );
|
386
|
-
await clickMenuItem( 'Create pattern' );
|
382
|
+
await clickMenuItem( 'Create pattern/reusable block' );
|
387
383
|
const nameInput = await page.waitForSelector(
|
388
384
|
reusableBlockNameInputSelector
|
389
385
|
);
|
390
386
|
await nameInput.click();
|
391
387
|
await page.keyboard.type( 'Block with styles' );
|
392
|
-
const syncToggle = await page.waitForSelector( syncToggleSelector );
|
393
|
-
syncToggle.click();
|
394
388
|
await page.waitForSelector( syncToggleSelectorChecked );
|
395
389
|
await page.keyboard.press( 'Enter' );
|
396
390
|
const reusableBlock = await canvas().waitForSelector(
|