@wordpress/e2e-tests 9.1.0 → 9.1.1-next.738bb1424.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/e2e-tests",
|
|
3
|
-
"version": "9.1.0",
|
|
3
|
+
"version": "9.1.1-next.738bb1424.0",
|
|
4
4
|
"description": "Test plugins and mu-plugins for E2E tests in WordPress.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"npm": ">=8.19.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@wordpress/interactivity": "^6.36.0",
|
|
28
|
-
"@wordpress/interactivity-router": "^2.36.0"
|
|
27
|
+
"@wordpress/interactivity": "^6.36.1-next.738bb1424.0",
|
|
28
|
+
"@wordpress/interactivity-router": "^2.36.1-next.738bb1424.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "ab1b004c0d61c295aa34bc86ea07f979343983ce"
|
|
34
34
|
}
|
|
@@ -84,7 +84,6 @@ const withBlockBindingsInspectorControl = createHigherOrderComponent(
|
|
|
84
84
|
{ title: 'Bindings' },
|
|
85
85
|
el( TextControl, {
|
|
86
86
|
__next40pxDefaultSize: true,
|
|
87
|
-
__nextHasNoMarginBottom: true,
|
|
88
87
|
label: 'Content',
|
|
89
88
|
value: props.attributes.content,
|
|
90
89
|
onChange: ( content ) =>
|
|
@@ -3,88 +3,115 @@
|
|
|
3
3
|
const PanelBody = wp.components.PanelBody;
|
|
4
4
|
const select = wp.data.select;
|
|
5
5
|
const dispatch = wp.data.dispatch;
|
|
6
|
+
const useSelect = wp.data.useSelect;
|
|
7
|
+
const useDispatch = wp.data.useDispatch;
|
|
6
8
|
const Fragment = wp.element.Fragment;
|
|
7
9
|
const el = wp.element.createElement;
|
|
8
|
-
const
|
|
10
|
+
const useState = wp.element.useState;
|
|
11
|
+
const useEffect = wp.element.useEffect;
|
|
9
12
|
const __ = wp.i18n.__;
|
|
10
13
|
const registerPlugin = wp.plugins.registerPlugin;
|
|
11
14
|
const PluginSidebar = wp.editor.PluginSidebar;
|
|
12
15
|
const PluginSidebarMoreMenuItem = wp.editor.PluginSidebarMoreMenuItem;
|
|
13
16
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
super( props );
|
|
17
|
+
function SidebarContents() {
|
|
18
|
+
const [ range, setRange ] = useState( { start: 0, end: 0 } );
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
}
|
|
20
|
+
const blocks = useSelect( ( sel ) => {
|
|
21
|
+
return sel( 'core/block-editor' ).getBlocks();
|
|
22
|
+
} );
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
value: this.state.end,
|
|
47
|
-
} ),
|
|
48
|
-
el(
|
|
49
|
-
Button,
|
|
50
|
-
{
|
|
51
|
-
variant: 'primary',
|
|
52
|
-
onClick: () => {
|
|
53
|
-
dispatch(
|
|
54
|
-
'core/annotations'
|
|
55
|
-
).__experimentalAddAnnotation( {
|
|
56
|
-
source: 'e2e-tests',
|
|
57
|
-
blockClientId:
|
|
58
|
-
select(
|
|
59
|
-
'core/block-editor'
|
|
60
|
-
).getBlockOrder()[ 0 ],
|
|
61
|
-
richTextIdentifier: 'content',
|
|
62
|
-
range: {
|
|
63
|
-
start: parseInt( this.state.start, 10 ),
|
|
64
|
-
end: parseInt( this.state.end, 10 ),
|
|
65
|
-
},
|
|
66
|
-
} );
|
|
24
|
+
const { __experimentalAddAnnotation: addAnnotation } =
|
|
25
|
+
useDispatch( 'core/annotations' );
|
|
26
|
+
|
|
27
|
+
const allBlocks = blocks
|
|
28
|
+
.filter( ( block ) => block.name === 'core/paragraph' )
|
|
29
|
+
.map( ( block ) => [
|
|
30
|
+
block.clientId,
|
|
31
|
+
block.attributes.content.text,
|
|
32
|
+
] );
|
|
33
|
+
|
|
34
|
+
useEffect( () => {
|
|
35
|
+
allBlocks.forEach( ( [ clientId, content ] ) => {
|
|
36
|
+
const applePosition = content.indexOf( 'apple' );
|
|
37
|
+
if ( applePosition !== -1 ) {
|
|
38
|
+
addAnnotation( {
|
|
39
|
+
source: 'test-annotation',
|
|
40
|
+
blockClientId: clientId,
|
|
41
|
+
richTextIdentifier: 'content',
|
|
42
|
+
range: {
|
|
43
|
+
start: applePosition,
|
|
44
|
+
end: applePosition + 5,
|
|
67
45
|
},
|
|
46
|
+
} );
|
|
47
|
+
}
|
|
48
|
+
} );
|
|
49
|
+
} );
|
|
50
|
+
|
|
51
|
+
return el(
|
|
52
|
+
PanelBody,
|
|
53
|
+
{},
|
|
54
|
+
el( 'input', {
|
|
55
|
+
type: 'number',
|
|
56
|
+
id: 'annotations-tests-range-start',
|
|
57
|
+
onChange: ( reactEvent ) => {
|
|
58
|
+
setRange( {
|
|
59
|
+
...range,
|
|
60
|
+
start: reactEvent.target.value,
|
|
61
|
+
} );
|
|
62
|
+
},
|
|
63
|
+
value: range.start,
|
|
64
|
+
} ),
|
|
65
|
+
el( 'input', {
|
|
66
|
+
type: 'number',
|
|
67
|
+
id: 'annotations-tests-range-end',
|
|
68
|
+
onChange: ( reactEvent ) => {
|
|
69
|
+
setRange( {
|
|
70
|
+
...range,
|
|
71
|
+
end: reactEvent.target.value,
|
|
72
|
+
} );
|
|
73
|
+
},
|
|
74
|
+
value: range.end,
|
|
75
|
+
} ),
|
|
76
|
+
el(
|
|
77
|
+
Button,
|
|
78
|
+
{
|
|
79
|
+
variant: 'primary',
|
|
80
|
+
onClick: () => {
|
|
81
|
+
dispatch(
|
|
82
|
+
'core/annotations'
|
|
83
|
+
).__experimentalAddAnnotation( {
|
|
84
|
+
source: 'e2e-tests',
|
|
85
|
+
blockClientId:
|
|
86
|
+
select(
|
|
87
|
+
'core/block-editor'
|
|
88
|
+
).getBlockOrder()[ 0 ],
|
|
89
|
+
richTextIdentifier: 'content',
|
|
90
|
+
range: {
|
|
91
|
+
start: parseInt( range.start, 10 ),
|
|
92
|
+
end: parseInt( range.end, 10 ),
|
|
93
|
+
},
|
|
94
|
+
} );
|
|
68
95
|
},
|
|
69
|
-
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
96
|
+
},
|
|
97
|
+
__( 'Add annotation' )
|
|
98
|
+
),
|
|
99
|
+
el(
|
|
100
|
+
Button,
|
|
101
|
+
{
|
|
102
|
+
variant: 'primary',
|
|
103
|
+
onClick: () => {
|
|
104
|
+
dispatch(
|
|
105
|
+
'core/annotations'
|
|
106
|
+
).__experimentalRemoveAnnotationsBySource(
|
|
107
|
+
'e2e-tests'
|
|
108
|
+
);
|
|
82
109
|
},
|
|
110
|
+
},
|
|
83
111
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
112
|
+
__( 'Remove annotations' )
|
|
113
|
+
)
|
|
114
|
+
);
|
|
88
115
|
}
|
|
89
116
|
|
|
90
117
|
function AnnotationsSidebar() {
|
|
@@ -48,6 +48,11 @@ add_action(
|
|
|
48
48
|
register_block_type(
|
|
49
49
|
'test/auto-register-block',
|
|
50
50
|
array(
|
|
51
|
+
'title' => 'Auto Register Test Block',
|
|
52
|
+
'icon' => 'admin-generic',
|
|
53
|
+
'category' => 'widgets',
|
|
54
|
+
'description' => 'A test block for auto-registration',
|
|
55
|
+
'keywords' => array( 'serverblock', 'autotest' ),
|
|
51
56
|
'render_callback' => static function ( $attributes ) {
|
|
52
57
|
$wrapper_attributes = get_block_wrapper_attributes(
|
|
53
58
|
array(
|