@wordpress/e2e-tests 8.27.0 → 8.28.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/package.json +9 -9
- package/plugins/interactive-blocks/router-styles-blue/render.php +9 -0
- package/plugins/interactive-blocks/router-styles-red/render.php +9 -0
- package/plugins/interactive-blocks/router-styles-wrapper/render.php +12 -3
- package/plugins/server-side-rendered-block/editor.js +49 -0
- package/plugins/server-side-rendered-block.php +47 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/e2e-tests",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.28.0",
|
|
4
4
|
"description": "End-To-End (E2E) tests for WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"npm": ">=8.19.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@wordpress/e2e-test-utils": "^11.
|
|
28
|
-
"@wordpress/interactivity": "^6.
|
|
29
|
-
"@wordpress/interactivity-router": "^2.
|
|
30
|
-
"@wordpress/jest-console": "^8.
|
|
31
|
-
"@wordpress/jest-puppeteer-axe": "^7.
|
|
32
|
-
"@wordpress/scripts": "^30.
|
|
33
|
-
"@wordpress/url": "^4.
|
|
27
|
+
"@wordpress/e2e-test-utils": "^11.28.0",
|
|
28
|
+
"@wordpress/interactivity": "^6.28.0",
|
|
29
|
+
"@wordpress/interactivity-router": "^2.28.0",
|
|
30
|
+
"@wordpress/jest-console": "^8.28.0",
|
|
31
|
+
"@wordpress/jest-puppeteer-axe": "^7.28.0",
|
|
32
|
+
"@wordpress/scripts": "^30.21.0",
|
|
33
|
+
"@wordpress/url": "^4.28.0",
|
|
34
34
|
"chalk": "^4.0.0",
|
|
35
35
|
"expect-puppeteer": "^4.4.0",
|
|
36
36
|
"filenamify": "^4.2.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"publishConfig": {
|
|
48
48
|
"access": "public"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "28cc2098f5ee28f89096b638533796538f495f72"
|
|
51
51
|
}
|
|
@@ -33,3 +33,12 @@ $wrapper_attributes = get_block_wrapper_attributes(
|
|
|
33
33
|
);
|
|
34
34
|
?>
|
|
35
35
|
<p <?php echo $wrapper_attributes; ?>>Blue</p>
|
|
36
|
+
|
|
37
|
+
<noscript>
|
|
38
|
+
<style>
|
|
39
|
+
.noscript-style-test {
|
|
40
|
+
color: rgb(0, 0, 255) !important;
|
|
41
|
+
background-color: yellow !important;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</noscript>
|
|
@@ -33,3 +33,12 @@ $wrapper_attributes = get_block_wrapper_attributes(
|
|
|
33
33
|
);
|
|
34
34
|
?>
|
|
35
35
|
<p <?php echo $wrapper_attributes; ?>>Red</p>
|
|
36
|
+
|
|
37
|
+
<noscript>
|
|
38
|
+
<style>
|
|
39
|
+
.noscript-style-test {
|
|
40
|
+
color: rgb(255, 0, 0) !important;
|
|
41
|
+
font-weight: bold !important;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
44
|
+
</noscript>
|
|
@@ -101,7 +101,16 @@ $wrapper_attributes = get_block_wrapper_attributes();
|
|
|
101
101
|
|
|
102
102
|
<!-- Text hidden when media=print applies. -->
|
|
103
103
|
<div class="hide-on-print" data-testid="hide-on-print">This should be visible when media is not "print".</div>
|
|
104
|
+
|
|
105
|
+
<!-- Element for testing noscript styles being ignored -->
|
|
106
|
+
<div data-testid="noscript-style-test" class="noscript-style-test">This should not be affected by styles in noscript tags</div>
|
|
107
|
+
|
|
108
|
+
<!-- Noscript styles that should be ignored -->
|
|
109
|
+
<noscript>
|
|
110
|
+
<style>
|
|
111
|
+
.noscript-style-test {
|
|
112
|
+
color: rgb(255, 0, 0) !important;
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
115
|
+
</noscript>
|
|
104
116
|
</div>
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
( function () {
|
|
2
|
+
const { createElement: el, Fragment } = wp.element;
|
|
3
|
+
const { registerBlockType } = wp.blocks;
|
|
4
|
+
const { InspectorControls, useBlockProps } = wp.blockEditor;
|
|
5
|
+
const ServerSideRender = wp.serverSideRender;
|
|
6
|
+
const { PanelBody, __experimentalNumberControl: NumberControl } =
|
|
7
|
+
wp.components;
|
|
8
|
+
|
|
9
|
+
registerBlockType( 'test/server-side-rendered-block', {
|
|
10
|
+
apiVersion: 3,
|
|
11
|
+
title: 'Test Server-Side Render',
|
|
12
|
+
icon: 'coffee',
|
|
13
|
+
category: 'text',
|
|
14
|
+
|
|
15
|
+
edit: function Edit( { attributes, setAttributes } ) {
|
|
16
|
+
const blockProps = useBlockProps();
|
|
17
|
+
return el(
|
|
18
|
+
Fragment,
|
|
19
|
+
null,
|
|
20
|
+
el(
|
|
21
|
+
InspectorControls,
|
|
22
|
+
{},
|
|
23
|
+
el(
|
|
24
|
+
PanelBody,
|
|
25
|
+
null,
|
|
26
|
+
el( NumberControl, {
|
|
27
|
+
label: 'Count',
|
|
28
|
+
value: attributes.count || 0,
|
|
29
|
+
min: 0,
|
|
30
|
+
max: 10,
|
|
31
|
+
__next40pxDefaultSize: true,
|
|
32
|
+
onChange: ( value ) => {
|
|
33
|
+
setAttributes( { count: value } );
|
|
34
|
+
},
|
|
35
|
+
} )
|
|
36
|
+
)
|
|
37
|
+
),
|
|
38
|
+
el(
|
|
39
|
+
'div',
|
|
40
|
+
blockProps,
|
|
41
|
+
el( ServerSideRender, {
|
|
42
|
+
block: 'test/server-side-rendered-block',
|
|
43
|
+
attributes,
|
|
44
|
+
} )
|
|
45
|
+
)
|
|
46
|
+
);
|
|
47
|
+
},
|
|
48
|
+
} );
|
|
49
|
+
} )();
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test Server-Side Rendered Block
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-server-side-rendered-block
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
add_action(
|
|
11
|
+
'init',
|
|
12
|
+
static function () {
|
|
13
|
+
wp_register_script(
|
|
14
|
+
'server-side-rendered-block',
|
|
15
|
+
plugins_url( 'server-side-rendered-block/editor.js', __FILE__ ),
|
|
16
|
+
array( 'wp-blocks', 'wp-element', 'wp-editor', 'wp-components', 'wp-server-side-render' ),
|
|
17
|
+
filemtime( plugin_dir_path( __FILE__ ) . 'server-side-rendered-block/editor.js' ),
|
|
18
|
+
true
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
register_block_type(
|
|
22
|
+
'test/server-side-rendered-block',
|
|
23
|
+
array(
|
|
24
|
+
'attributes' => array(
|
|
25
|
+
'count' => array(
|
|
26
|
+
'type' => 'number',
|
|
27
|
+
'default' => 0,
|
|
28
|
+
),
|
|
29
|
+
),
|
|
30
|
+
'render_callback' => static function ( $attributes ) {
|
|
31
|
+
$count = isset( $attributes['count'] ) ? absint( $attributes['count'] ) : 0;
|
|
32
|
+
|
|
33
|
+
// Simulate an empty response when count is over maximum value = 10.
|
|
34
|
+
if ( $count > 10 ) {
|
|
35
|
+
return '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return sprintf(
|
|
39
|
+
'<p>Coffee count: %d</p>',
|
|
40
|
+
$count
|
|
41
|
+
);
|
|
42
|
+
},
|
|
43
|
+
'editor_script_handles' => array( 'server-side-rendered-block' ),
|
|
44
|
+
)
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
);
|