@wordpress/e2e-tests 9.16.0 → 9.18.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 +5 -0
- package/package.json +4 -4
- package/plugins/block-context/index.js +3 -2
- package/plugins/block-icons/index.js +5 -40
- package/plugins/custom-post-types.php +28 -0
- package/plugins/disable-cross-origin-isolation.php +18 -0
- package/plugins/disable-post-revisions.php +10 -0
- package/plugins/inner-blocks-locking-all-embed/index.js +1 -1
- package/plugins/inner-blocks-templates/index.js +20 -15
- package/plugins/interactive-blocks/deferred-store/view.js +0 -3
- package/plugins/interactive-blocks/directive-bind/view.js +0 -3
- package/plugins/interactive-blocks/directive-class/view.js +0 -3
- package/plugins/interactive-blocks/directive-context/view.js +0 -3
- package/plugins/interactive-blocks/directive-each/view.js +0 -3
- package/plugins/interactive-blocks/directive-init/view.js +0 -3
- package/plugins/interactive-blocks/directive-key/view.js +0 -3
- package/plugins/interactive-blocks/directive-on/view.js +0 -3
- package/plugins/interactive-blocks/directive-on-document/view.js +0 -3
- package/plugins/interactive-blocks/directive-on-window/view.js +0 -3
- package/plugins/interactive-blocks/directive-priorities/view.js +0 -3
- package/plugins/interactive-blocks/directive-run/view.js +0 -3
- package/plugins/interactive-blocks/directive-style/view.js +0 -3
- package/plugins/interactive-blocks/directive-text/view.js +0 -3
- package/plugins/interactive-blocks/directive-watch/view.js +0 -3
- package/plugins/interactive-blocks/generator-scope/view.js +0 -3
- package/plugins/interactive-blocks/get-server-context/view.js +0 -3
- package/plugins/interactive-blocks/get-server-state/view.js +0 -3
- package/plugins/interactive-blocks/hydration-timing/view.js +0 -3
- package/plugins/interactive-blocks/hydration-timing-slow/view.js +0 -3
- package/plugins/interactive-blocks/namespace/view.js +0 -3
- package/plugins/interactive-blocks/negation-operator/view.js +0 -3
- package/plugins/interactive-blocks/router-navigate/view.js +0 -3
- package/plugins/interactive-blocks/router-race-condition/view.js +0 -3
- package/plugins/interactive-blocks/router-regions/view.js +0 -3
- package/plugins/interactive-blocks/router-script-modules-alpha/view.js +0 -7
- package/plugins/interactive-blocks/router-script-modules-bravo/view.js +0 -7
- package/plugins/interactive-blocks/router-script-modules-charlie/view.js +0 -7
- package/plugins/interactive-blocks/router-script-modules-wrapper/view.js +0 -3
- package/plugins/interactive-blocks/router-styles-wrapper/view.js +0 -3
- package/plugins/interactive-blocks/store/view.js +0 -3
- package/plugins/interactive-blocks/store-tag/view.js +0 -3
- package/plugins/interactive-blocks/tovdom/view.js +0 -3
- package/plugins/interactive-blocks/tovdom-islands/view.js +0 -3
- package/plugins/interactive-blocks/with-scope/view.js +0 -3
- package/plugins/meta-box.php +2 -0
- package/plugins/react-18-compat-block/editor.js +12 -4
- package/plugins/table-of-contents-heading-source/index.js +95 -0
- package/plugins/table-of-contents-heading-source.php +27 -0
- package/plugins/view-config-extensibility.php +110 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/e2e-tests",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.18.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,8 +24,8 @@
|
|
|
24
24
|
"npm": ">=8.19.2"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@wordpress/interactivity": "^6.
|
|
28
|
-
"@wordpress/interactivity-router": "^2.
|
|
27
|
+
"@wordpress/interactivity": "^6.53.0",
|
|
28
|
+
"@wordpress/interactivity-router": "^2.53.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"y-websocket": "^3.0.0"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"publishConfig": {
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "989764d42ff93e33684aaf0b96a5b7f3d9bbff52"
|
|
42
42
|
}
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
category: 'text',
|
|
20
20
|
|
|
21
|
+
template: [ [ 'gutenberg/test-context-consumer', {} ] ],
|
|
22
|
+
templateInsertUpdatesSelection: true,
|
|
23
|
+
|
|
21
24
|
edit: function Edit( { attributes, setAttributes } ) {
|
|
22
25
|
const blockProps = useBlockProps();
|
|
23
26
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
24
|
-
template: [ [ 'gutenberg/test-context-consumer', {} ] ],
|
|
25
27
|
templateLock: 'all',
|
|
26
|
-
templateInsertUpdatesSelection: true,
|
|
27
28
|
} );
|
|
28
29
|
return el(
|
|
29
30
|
'div',
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
registerBlockType( 'test/test-single-svg-icon', {
|
|
20
20
|
apiVersion: 3,
|
|
21
21
|
title: 'TestSimpleSvgIcon',
|
|
22
|
+
template: [ [ 'core/paragraph', { content: 'TestSimpleSvgIcon' } ] ],
|
|
22
23
|
icon: svg,
|
|
23
24
|
category: 'text',
|
|
24
25
|
|
|
@@ -29,14 +30,6 @@
|
|
|
29
30
|
} );
|
|
30
31
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
31
32
|
allowedBlocks: [ 'core/paragraph', 'core/image' ],
|
|
32
|
-
template: [
|
|
33
|
-
[
|
|
34
|
-
'core/paragraph',
|
|
35
|
-
{
|
|
36
|
-
content: 'TestSimpleSvgIcon',
|
|
37
|
-
},
|
|
38
|
-
],
|
|
39
|
-
],
|
|
40
33
|
} );
|
|
41
34
|
return el( 'div', innerBlocksProps );
|
|
42
35
|
},
|
|
@@ -56,6 +49,7 @@
|
|
|
56
49
|
registerBlockType( 'test/test-dash-icon', {
|
|
57
50
|
apiVersion: 3,
|
|
58
51
|
title: 'TestSimpleDashIcon',
|
|
52
|
+
template: [ [ 'core/paragraph', { content: 'TestDashIcon' } ] ],
|
|
59
53
|
icon: 'cart',
|
|
60
54
|
category: 'text',
|
|
61
55
|
|
|
@@ -66,14 +60,6 @@
|
|
|
66
60
|
} );
|
|
67
61
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
68
62
|
allowedBlocks: [ 'core/paragraph', 'core/image' ],
|
|
69
|
-
template: [
|
|
70
|
-
[
|
|
71
|
-
'core/paragraph',
|
|
72
|
-
{
|
|
73
|
-
content: 'TestDashIcon',
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
],
|
|
77
63
|
} );
|
|
78
64
|
return el( 'div', innerBlocksProps );
|
|
79
65
|
},
|
|
@@ -93,6 +79,7 @@
|
|
|
93
79
|
registerBlockType( 'test/test-function-icon', {
|
|
94
80
|
apiVersion: 3,
|
|
95
81
|
title: 'TestFunctionIcon',
|
|
82
|
+
template: [ [ 'core/paragraph', { content: 'TestFunctionIcon' } ] ],
|
|
96
83
|
icon() {
|
|
97
84
|
return svg;
|
|
98
85
|
},
|
|
@@ -105,14 +92,6 @@
|
|
|
105
92
|
} );
|
|
106
93
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
107
94
|
allowedBlocks: [ 'core/paragraph', 'core/image' ],
|
|
108
|
-
template: [
|
|
109
|
-
[
|
|
110
|
-
'core/paragraph',
|
|
111
|
-
{
|
|
112
|
-
content: 'TestFunctionIcon',
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
],
|
|
116
95
|
} );
|
|
117
96
|
return el( 'div', innerBlocksProps );
|
|
118
97
|
},
|
|
@@ -132,6 +111,7 @@
|
|
|
132
111
|
registerBlockType( 'test/test-dash-icon-colors', {
|
|
133
112
|
apiVersion: 3,
|
|
134
113
|
title: 'TestDashIconColors',
|
|
114
|
+
template: [ [ 'core/paragraph', { content: 'TestIconColors' } ] ],
|
|
135
115
|
icon: {
|
|
136
116
|
background: '#010000',
|
|
137
117
|
foreground: '#fe0000',
|
|
@@ -146,14 +126,6 @@
|
|
|
146
126
|
} );
|
|
147
127
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
148
128
|
allowedBlocks: [ 'core/paragraph', 'core/image' ],
|
|
149
|
-
template: [
|
|
150
|
-
[
|
|
151
|
-
'core/paragraph',
|
|
152
|
-
{
|
|
153
|
-
content: 'TestIconColors',
|
|
154
|
-
},
|
|
155
|
-
],
|
|
156
|
-
],
|
|
157
129
|
} );
|
|
158
130
|
return el( 'div', innerBlocksProps );
|
|
159
131
|
},
|
|
@@ -173,6 +145,7 @@
|
|
|
173
145
|
registerBlockType( 'test/test-svg-icon-background', {
|
|
174
146
|
apiVersion: 3,
|
|
175
147
|
title: 'TestSvgIconBackground',
|
|
148
|
+
template: [ [ 'core/paragraph', { content: 'TestIconColors' } ] ],
|
|
176
149
|
icon: {
|
|
177
150
|
background: '#010000',
|
|
178
151
|
src: svg,
|
|
@@ -186,14 +159,6 @@
|
|
|
186
159
|
} );
|
|
187
160
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
188
161
|
allowedBlocks: [ 'core/paragraph', 'core/image' ],
|
|
189
|
-
template: [
|
|
190
|
-
[
|
|
191
|
-
'core/paragraph',
|
|
192
|
-
{
|
|
193
|
-
content: 'TestIconColors',
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
],
|
|
197
162
|
} );
|
|
198
163
|
return el( 'div', innerBlocksProps );
|
|
199
164
|
},
|
|
@@ -87,6 +87,34 @@ function public_queryable_true_public_true_cpt() {
|
|
|
87
87
|
}
|
|
88
88
|
add_action( 'init', 'public_queryable_true_public_true_cpt' );
|
|
89
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Registers a custom post type with real-time collaboration disabled.
|
|
92
|
+
*/
|
|
93
|
+
function gutenberg_test_register_collaboration_disabled_post_type() {
|
|
94
|
+
register_post_type(
|
|
95
|
+
'rtc_disabled',
|
|
96
|
+
array(
|
|
97
|
+
'label' => 'RTC Disabled',
|
|
98
|
+
'show_in_rest' => true,
|
|
99
|
+
'public' => true,
|
|
100
|
+
'supports' => array( 'title', 'editor', 'revisions' ),
|
|
101
|
+
)
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
add_action( 'init', 'gutenberg_test_register_collaboration_disabled_post_type' );
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Disables real-time collaboration for the test post type.
|
|
108
|
+
*
|
|
109
|
+
* @param bool $disabled Whether collaboration is disabled.
|
|
110
|
+
* @param string $post_type Post type name.
|
|
111
|
+
* @return bool Whether collaboration is disabled.
|
|
112
|
+
*/
|
|
113
|
+
function gutenberg_test_disable_post_type_collaboration( $disabled, $post_type ) {
|
|
114
|
+
return 'rtc_disabled' === $post_type ? true : $disabled;
|
|
115
|
+
}
|
|
116
|
+
add_filter( 'wp_is_post_type_collaboration_disabled', 'gutenberg_test_disable_post_type_collaboration', 10, 2 );
|
|
117
|
+
|
|
90
118
|
/**
|
|
91
119
|
* Registers a custom post type that is hierarchical and does not supports the title attribute.
|
|
92
120
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test Plugin: Disable Cross-Origin Isolation
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-disable-cross-origin-isolation
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/*
|
|
11
|
+
* Skip the Document-Isolation-Policy header while leaving client-side media
|
|
12
|
+
* processing enabled. Without cross-origin isolation, SharedArrayBuffer is
|
|
13
|
+
* unavailable, so the full VIPS/WASM pipeline fails feature detection and the
|
|
14
|
+
* editor falls back to the HEIC canvas conversion mode — mirroring Safari,
|
|
15
|
+
* where full client-side processing is unsupported but HEIC files are still
|
|
16
|
+
* converted to JPEG via createImageBitmap + OffscreenCanvas before upload.
|
|
17
|
+
*/
|
|
18
|
+
add_filter( 'gutenberg_use_document_isolation_policy', '__return_false' );
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test Plugin, Disable Post Revisions
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-disable-post-revisions
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
add_filter( 'wp_revisions_to_keep', '__return_zero' );
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
title: 'Test Inner Blocks Locking All Embed',
|
|
24
24
|
icon: 'cart',
|
|
25
25
|
category: 'text',
|
|
26
|
+
template: TEMPLATE,
|
|
26
27
|
|
|
27
28
|
edit: function Edit() {
|
|
28
29
|
const blockProps = useBlockProps();
|
|
29
30
|
const innerBlocksProps = useInnerBlocksProps( blockProps, {
|
|
30
|
-
template: TEMPLATE,
|
|
31
31
|
templateLock: 'all',
|
|
32
32
|
} );
|
|
33
33
|
return el( 'div', innerBlocksProps );
|
|
@@ -51,15 +51,10 @@
|
|
|
51
51
|
title: 'Test Inner Blocks no locking',
|
|
52
52
|
icon: 'cart',
|
|
53
53
|
category: 'text',
|
|
54
|
+
template: TEMPLATE,
|
|
54
55
|
|
|
55
56
|
edit: function InnerBlocksNoLockingEdit() {
|
|
56
|
-
return el(
|
|
57
|
-
'div',
|
|
58
|
-
useBlockProps(),
|
|
59
|
-
el( InnerBlocks, {
|
|
60
|
-
template: TEMPLATE,
|
|
61
|
-
} )
|
|
62
|
-
);
|
|
57
|
+
return el( 'div', useBlockProps(), el( InnerBlocks ) );
|
|
63
58
|
},
|
|
64
59
|
|
|
65
60
|
save,
|
|
@@ -70,13 +65,13 @@
|
|
|
70
65
|
title: 'Test InnerBlocks locking all',
|
|
71
66
|
icon: 'cart',
|
|
72
67
|
category: 'text',
|
|
68
|
+
template: TEMPLATE,
|
|
73
69
|
|
|
74
70
|
edit: function InnerBlocksBlocksLockingAllEdit() {
|
|
75
71
|
return el(
|
|
76
72
|
'div',
|
|
77
73
|
useBlockProps(),
|
|
78
74
|
el( InnerBlocks, {
|
|
79
|
-
template: TEMPLATE,
|
|
80
75
|
templateLock: 'all',
|
|
81
76
|
} )
|
|
82
77
|
);
|
|
@@ -133,8 +128,23 @@
|
|
|
133
128
|
title: 'Test Inner Blocks Paragraph Placeholder',
|
|
134
129
|
icon: 'cart',
|
|
135
130
|
category: 'text',
|
|
131
|
+
template: TEMPLATE_PARAGRAPH_PLACEHOLDER,
|
|
132
|
+
templateInsertUpdatesSelection: true,
|
|
136
133
|
|
|
137
134
|
edit: function InnerBlocksParagraphPlaceholderEdit() {
|
|
135
|
+
return el( 'div', useBlockProps(), el( InnerBlocks ) );
|
|
136
|
+
},
|
|
137
|
+
|
|
138
|
+
save,
|
|
139
|
+
} );
|
|
140
|
+
|
|
141
|
+
registerBlockType( 'test/test-inner-blocks-deprecated-props', {
|
|
142
|
+
apiVersion: 3,
|
|
143
|
+
title: 'Test Inner Blocks deprecated props',
|
|
144
|
+
icon: 'cart',
|
|
145
|
+
category: 'text',
|
|
146
|
+
|
|
147
|
+
edit: function InnerBlocksDeprecatedPropsEdit() {
|
|
138
148
|
return el(
|
|
139
149
|
'div',
|
|
140
150
|
useBlockProps(),
|
|
@@ -153,6 +163,7 @@
|
|
|
153
163
|
title: 'Test Inner Blocks transformer target',
|
|
154
164
|
icon: 'cart',
|
|
155
165
|
category: 'text',
|
|
166
|
+
template: TEMPLATE,
|
|
156
167
|
|
|
157
168
|
transforms: {
|
|
158
169
|
from: [
|
|
@@ -189,13 +200,7 @@
|
|
|
189
200
|
},
|
|
190
201
|
|
|
191
202
|
edit: function InnerBlocksTransformerTargetEdit() {
|
|
192
|
-
return el(
|
|
193
|
-
'div',
|
|
194
|
-
useBlockProps(),
|
|
195
|
-
el( InnerBlocks, {
|
|
196
|
-
template: TEMPLATE,
|
|
197
|
-
} )
|
|
198
|
-
);
|
|
203
|
+
return el( 'div', useBlockProps(), el( InnerBlocks ) );
|
|
199
204
|
},
|
|
200
205
|
|
|
201
206
|
save,
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { store } from '@wordpress/interactivity';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* External dependencies
|
|
8
|
-
*/
|
|
9
2
|
// eslint-disable-next-line import/no-unresolved
|
|
10
3
|
import nameStatic from 'test/router-script-modules-alpha-1';
|
|
11
4
|
// eslint-disable-next-line import/no-unresolved
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { store } from '@wordpress/interactivity';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* External dependencies
|
|
8
|
-
*/
|
|
9
2
|
// eslint-disable-next-line import/no-unresolved
|
|
10
3
|
import nameStatic from 'test/router-script-modules-bravo-1';
|
|
11
4
|
// eslint-disable-next-line import/no-unresolved
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WordPress dependencies
|
|
3
|
-
*/
|
|
4
1
|
import { store } from '@wordpress/interactivity';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* External dependencies
|
|
8
|
-
*/
|
|
9
2
|
// eslint-disable-next-line import/no-unresolved
|
|
10
3
|
import nameStatic from 'test/router-script-modules-charlie-1';
|
|
11
4
|
// eslint-disable-next-line import/no-unresolved
|
package/plugins/meta-box.php
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
*/
|
|
13
13
|
function gutenberg_test_meta_box_render_meta_box() {
|
|
14
14
|
echo 'Hello World';
|
|
15
|
+
echo '<label for="gutenberg_test_meta_box_input">Test meta box field</label>';
|
|
16
|
+
echo '<input type="text" id="gutenberg_test_meta_box_input" name="gutenberg_test_meta_box_input" />';
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -99,18 +99,26 @@
|
|
|
99
99
|
return jsx( 'div', {
|
|
100
100
|
...blockProps,
|
|
101
101
|
children: [
|
|
102
|
-
// An element that relies on the `inert` attribute, created with
|
|
103
|
-
// the bundled React 18 runtime (legacy `react.element` symbol).
|
|
104
102
|
jsxDEV(
|
|
105
103
|
'div',
|
|
106
104
|
{
|
|
107
|
-
className: 'react-18-compat-block__inert',
|
|
105
|
+
className: 'react-18-compat-block__inert-string',
|
|
108
106
|
inert: '',
|
|
109
107
|
children:
|
|
110
|
-
'This subtree is inert and
|
|
108
|
+
'This subtree is inert and uses a React 18 style string attribute.',
|
|
111
109
|
},
|
|
112
110
|
'inert'
|
|
113
111
|
),
|
|
112
|
+
jsx(
|
|
113
|
+
'div',
|
|
114
|
+
{
|
|
115
|
+
className: 'react-18-compat-block__inert-boolean',
|
|
116
|
+
inert: true,
|
|
117
|
+
children:
|
|
118
|
+
'This subtree is inert and uses a React 19 style boolean attribute.',
|
|
119
|
+
},
|
|
120
|
+
'inert-boolean'
|
|
121
|
+
),
|
|
114
122
|
// The `defaultProps` component, created with the
|
|
115
123
|
// externalized React runtime.
|
|
116
124
|
jsx( Greeting, {}, 'greeting' ),
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
( function () {
|
|
2
|
+
const { registerBlockType } = wp.blocks;
|
|
3
|
+
const { useBlockProps } = wp.blockEditor;
|
|
4
|
+
const { createElement: el } = wp.element;
|
|
5
|
+
|
|
6
|
+
function getHeadingTagName( level ) {
|
|
7
|
+
return Number.isInteger( level ) && level >= 1 && level <= 6
|
|
8
|
+
? `h${ level }`
|
|
9
|
+
: 'h2';
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function getAnchorProps( anchor ) {
|
|
13
|
+
return typeof anchor === 'string' && anchor !== ''
|
|
14
|
+
? { id: anchor }
|
|
15
|
+
: {};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
registerBlockType( 'e2e-tests/table-of-contents-heading-source', {
|
|
19
|
+
apiVersion: 3,
|
|
20
|
+
title: 'ToC Heading Source',
|
|
21
|
+
description: 'A test block that renders a heading-like section.',
|
|
22
|
+
category: 'text',
|
|
23
|
+
attributes: {
|
|
24
|
+
content: {
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: 'Plugin heading source',
|
|
27
|
+
},
|
|
28
|
+
anchor: {
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: 'plugin-heading-source',
|
|
31
|
+
},
|
|
32
|
+
level: {
|
|
33
|
+
type: 'number',
|
|
34
|
+
default: 2,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
edit: function Edit( { attributes } ) {
|
|
38
|
+
const TagName = getHeadingTagName( attributes.level );
|
|
39
|
+
|
|
40
|
+
return el(
|
|
41
|
+
TagName,
|
|
42
|
+
useBlockProps( getAnchorProps( attributes.anchor ) ),
|
|
43
|
+
attributes.content
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
save: function Save( { attributes } ) {
|
|
47
|
+
const TagName = getHeadingTagName( attributes.level );
|
|
48
|
+
|
|
49
|
+
return el(
|
|
50
|
+
TagName,
|
|
51
|
+
useBlockProps.save( getAnchorProps( attributes.anchor ) ),
|
|
52
|
+
attributes.content
|
|
53
|
+
);
|
|
54
|
+
},
|
|
55
|
+
} );
|
|
56
|
+
|
|
57
|
+
registerBlockType( 'e2e-tests/table-of-contents-heading-like', {
|
|
58
|
+
apiVersion: 3,
|
|
59
|
+
title: 'ToC Heading Like',
|
|
60
|
+
description: 'A test block that renders a heading-like section.',
|
|
61
|
+
category: 'text',
|
|
62
|
+
attributes: {
|
|
63
|
+
content: {
|
|
64
|
+
type: 'string',
|
|
65
|
+
default: 'Plain heading-like block',
|
|
66
|
+
},
|
|
67
|
+
anchor: {
|
|
68
|
+
type: 'string',
|
|
69
|
+
default: 'unregistered-heading-like-source',
|
|
70
|
+
},
|
|
71
|
+
level: {
|
|
72
|
+
type: 'number',
|
|
73
|
+
default: 2,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
edit: function Edit( { attributes } ) {
|
|
77
|
+
const TagName = getHeadingTagName( attributes.level );
|
|
78
|
+
|
|
79
|
+
return el(
|
|
80
|
+
TagName,
|
|
81
|
+
useBlockProps( getAnchorProps( attributes.anchor ) ),
|
|
82
|
+
attributes.content
|
|
83
|
+
);
|
|
84
|
+
},
|
|
85
|
+
save: function Save( { attributes } ) {
|
|
86
|
+
const TagName = getHeadingTagName( attributes.level );
|
|
87
|
+
|
|
88
|
+
return el(
|
|
89
|
+
TagName,
|
|
90
|
+
useBlockProps.save( getAnchorProps( attributes.anchor ) ),
|
|
91
|
+
attributes.content
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
} );
|
|
95
|
+
} )();
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test Table of Contents Heading Source
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-table-of-contents-heading-source
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Enqueues the test block used by Table of Contents e2e coverage in the block editor.
|
|
12
|
+
*/
|
|
13
|
+
function gutenberg_test_table_of_contents_heading_source_enqueue() {
|
|
14
|
+
wp_enqueue_script(
|
|
15
|
+
'gutenberg-test-table-of-contents-heading-source',
|
|
16
|
+
plugins_url( 'table-of-contents-heading-source/index.js', __FILE__ ),
|
|
17
|
+
array(
|
|
18
|
+
'wp-blocks',
|
|
19
|
+
'wp-block-editor',
|
|
20
|
+
'wp-element',
|
|
21
|
+
),
|
|
22
|
+
filemtime( plugin_dir_path( __FILE__ ) . 'table-of-contents-heading-source/index.js' ),
|
|
23
|
+
true
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
add_action( 'enqueue_block_editor_assets', 'gutenberg_test_table_of_contents_heading_source_enqueue' );
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
/**
|
|
3
|
+
* Plugin Name: Gutenberg Test View Config Extensibility
|
|
4
|
+
* Plugin URI: https://github.com/WordPress/gutenberg
|
|
5
|
+
* Author: Gutenberg Team
|
|
6
|
+
*
|
|
7
|
+
* @package gutenberg-test-view-config-extensibility
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Customizes the Pages view configuration for end-to-end testing.
|
|
12
|
+
*
|
|
13
|
+
* @param Gutenberg_View_Config_Data $data The Pages view configuration.
|
|
14
|
+
* @return Gutenberg_View_Config_Data The customized configuration.
|
|
15
|
+
*/
|
|
16
|
+
function gutenberg_test_customize_page_view_config( $data ) {
|
|
17
|
+
$data->merge(
|
|
18
|
+
array(
|
|
19
|
+
'default_view' => array(
|
|
20
|
+
'type' => 'table',
|
|
21
|
+
'sort' => array(
|
|
22
|
+
'field' => 'date',
|
|
23
|
+
'direction' => 'desc',
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
'view_list' => array(
|
|
27
|
+
array(
|
|
28
|
+
'slug' => 'drafts',
|
|
29
|
+
'title' => 'In progress',
|
|
30
|
+
'view' => array(
|
|
31
|
+
'filters' => array(
|
|
32
|
+
array(
|
|
33
|
+
'field' => 'date',
|
|
34
|
+
'operator' => 'after',
|
|
35
|
+
'value' => '2018-01-01T00:00:00',
|
|
36
|
+
'isLocked' => true,
|
|
37
|
+
),
|
|
38
|
+
),
|
|
39
|
+
),
|
|
40
|
+
),
|
|
41
|
+
array(
|
|
42
|
+
'slug' => 'published-after-2020',
|
|
43
|
+
'title' => 'Published after 2020',
|
|
44
|
+
'view' => array(
|
|
45
|
+
'filters' => array(
|
|
46
|
+
array(
|
|
47
|
+
'field' => 'status',
|
|
48
|
+
'operator' => 'isAny',
|
|
49
|
+
'value' => 'publish',
|
|
50
|
+
'isLocked' => true,
|
|
51
|
+
),
|
|
52
|
+
array(
|
|
53
|
+
'field' => 'date',
|
|
54
|
+
'operator' => 'after',
|
|
55
|
+
'value' => '2020-12-31T23:59:59',
|
|
56
|
+
'isLocked' => true,
|
|
57
|
+
),
|
|
58
|
+
),
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
),
|
|
62
|
+
'form' => array(
|
|
63
|
+
'layout' => array( 'type' => 'regular' ),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
1
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
$data->remove(
|
|
70
|
+
array(
|
|
71
|
+
'default_view' => array(
|
|
72
|
+
'fields' => array( 'author' ),
|
|
73
|
+
),
|
|
74
|
+
'view_list' => array( 'future' ),
|
|
75
|
+
),
|
|
76
|
+
1
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
$data->set(
|
|
80
|
+
array(
|
|
81
|
+
'default_layouts' => array(
|
|
82
|
+
'table' => array(
|
|
83
|
+
'layout' => array(
|
|
84
|
+
'styles' => array(
|
|
85
|
+
'status' => array(
|
|
86
|
+
'width' => '240px',
|
|
87
|
+
),
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
),
|
|
91
|
+
),
|
|
92
|
+
),
|
|
93
|
+
1
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
$data->replace(
|
|
97
|
+
array(
|
|
98
|
+
'form' => array(
|
|
99
|
+
'fields' => array( 'slug' ),
|
|
100
|
+
),
|
|
101
|
+
),
|
|
102
|
+
1
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
return $data;
|
|
106
|
+
}
|
|
107
|
+
add_filter(
|
|
108
|
+
'get_entity_view_config_posttype_page',
|
|
109
|
+
'gutenberg_test_customize_page_view_config'
|
|
110
|
+
);
|