@wordpress/e2e-tests 7.6.4 → 7.8.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/deprecated-node-matcher/index.js +12 -16
- package/plugins/deprecated-node-matcher.php +0 -1
- 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-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/container-blocks.test.js +2 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +1 -1
- package/specs/editor/various/reusable-blocks.test.js +2 -2
@@ -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
|
+
);
|
@@ -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();
|
@@ -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(
|
@@ -197,7 +197,7 @@ describe( 'Reusable blocks', () => {
|
|
197
197
|
|
198
198
|
// Convert block to a reusable block.
|
199
199
|
await clickBlockToolbarButton( 'Options' );
|
200
|
-
await clickMenuItem( 'Create pattern' );
|
200
|
+
await clickMenuItem( 'Create pattern/reusable block' );
|
201
201
|
|
202
202
|
// Set title.
|
203
203
|
const nameInput = await page.waitForSelector(
|
@@ -383,7 +383,7 @@ describe( 'Reusable blocks', () => {
|
|
383
383
|
|
384
384
|
// Convert to reusable.
|
385
385
|
await clickBlockToolbarButton( 'Options' );
|
386
|
-
await clickMenuItem( 'Create pattern' );
|
386
|
+
await clickMenuItem( 'Create pattern/reusable block' );
|
387
387
|
const nameInput = await page.waitForSelector(
|
388
388
|
reusableBlockNameInputSelector
|
389
389
|
);
|