@wordpress/e2e-tests 4.7.0 → 4.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/package.json +6 -6
- package/plugins/cpt-locking.php +28 -4
- package/specs/editor/blocks/__snapshots__/quote.test.js.snap +37 -131
- package/specs/editor/blocks/navigation.test.js +2 -1
- package/specs/editor/blocks/quote.test.js +9 -104
- package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +24 -8
- package/specs/editor/plugins/__snapshots__/inner-blocks-render-appender.test.js.snap +6 -2
- package/specs/editor/plugins/__snapshots__/templates.test.js.snap +6 -2
- package/specs/editor/plugins/block-variations.test.js +2 -0
- package/specs/editor/plugins/cpt-locking.test.js +3 -3
- package/specs/editor/plugins/inner-blocks-render-appender.test.js +3 -0
- package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +0 -16
- package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +3 -3
- package/specs/editor/various/block-switcher.test.js +1 -3
- package/specs/editor/various/multi-block-selection.test.js +2 -27
- package/specs/editor/various/reusable-blocks.test.js +2 -0
- package/specs/editor/various/writing-flow.test.js +74 -1
- package/specs/editor/plugins/__snapshots__/hooks-api.test.js.snap +0 -3
- package/specs/editor/plugins/hooks-api.test.js +0 -44
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.8.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",
|
@@ -23,11 +23,11 @@
|
|
23
23
|
"node": ">=12"
|
24
24
|
},
|
25
25
|
"dependencies": {
|
26
|
-
"@wordpress/e2e-test-utils": "^7.
|
26
|
+
"@wordpress/e2e-test-utils": "^7.10.0",
|
27
27
|
"@wordpress/jest-console": "^5.4.0",
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^4.0
|
29
|
-
"@wordpress/scripts": "^23.
|
30
|
-
"@wordpress/url": "^3.
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^4.1.0",
|
29
|
+
"@wordpress/scripts": "^23.6.0",
|
30
|
+
"@wordpress/url": "^3.15.0",
|
31
31
|
"chalk": "^4.0.0",
|
32
32
|
"expect-puppeteer": "^4.4.0",
|
33
33
|
"filenamify": "^4.2.0",
|
@@ -46,5 +46,5 @@
|
|
46
46
|
"publishConfig": {
|
47
47
|
"access": "public"
|
48
48
|
},
|
49
|
-
"gitHead": "
|
49
|
+
"gitHead": "0315dbc240cb2aa146d7c1bafd251f004b88300e"
|
50
50
|
}
|
package/plugins/cpt-locking.php
CHANGED
@@ -19,7 +19,13 @@ function gutenberg_test_cpt_locking() {
|
|
19
19
|
'placeholder' => 'Add a description',
|
20
20
|
),
|
21
21
|
),
|
22
|
-
array(
|
22
|
+
array(
|
23
|
+
'core/quote',
|
24
|
+
array(),
|
25
|
+
array(
|
26
|
+
array( 'core/paragraph' ),
|
27
|
+
),
|
28
|
+
),
|
23
29
|
array( 'core/columns' ),
|
24
30
|
);
|
25
31
|
register_post_type(
|
@@ -65,7 +71,13 @@ function gutenberg_test_cpt_locking() {
|
|
65
71
|
'templateLock' => false,
|
66
72
|
),
|
67
73
|
array(
|
68
|
-
array(
|
74
|
+
array(
|
75
|
+
'core/quote',
|
76
|
+
array(),
|
77
|
+
array(
|
78
|
+
array( 'core/paragraph' ),
|
79
|
+
),
|
80
|
+
),
|
69
81
|
array(
|
70
82
|
'core/paragraph',
|
71
83
|
array(
|
@@ -91,7 +103,13 @@ function gutenberg_test_cpt_locking() {
|
|
91
103
|
'templateLock' => 'all',
|
92
104
|
),
|
93
105
|
array(
|
94
|
-
array(
|
106
|
+
array(
|
107
|
+
'core/quote',
|
108
|
+
array(),
|
109
|
+
array(
|
110
|
+
array( 'core/paragraph' ),
|
111
|
+
),
|
112
|
+
),
|
95
113
|
array(
|
96
114
|
'core/paragraph',
|
97
115
|
array(
|
@@ -115,7 +133,13 @@ function gutenberg_test_cpt_locking() {
|
|
115
133
|
'core/group',
|
116
134
|
array(),
|
117
135
|
array(
|
118
|
-
array(
|
136
|
+
array(
|
137
|
+
'core/quote',
|
138
|
+
array(),
|
139
|
+
array(
|
140
|
+
array( 'core/paragraph' ),
|
141
|
+
),
|
142
|
+
),
|
119
143
|
array(
|
120
144
|
'core/paragraph',
|
121
145
|
array(
|
@@ -34,180 +34,86 @@ exports[`Quote can be converted to paragraphs and renders one paragraph block pe
|
|
34
34
|
|
35
35
|
exports[`Quote can be converted to paragraphs and renders only one paragraph for the cite, if the quote is void 1`] = `
|
36
36
|
"<!-- wp:paragraph -->
|
37
|
+
<p></p>
|
38
|
+
<!-- /wp:paragraph -->
|
39
|
+
|
40
|
+
<!-- wp:paragraph -->
|
37
41
|
<p>cite</p>
|
38
42
|
<!-- /wp:paragraph -->"
|
39
43
|
`;
|
40
44
|
|
41
45
|
exports[`Quote can be created by converting a heading 1`] = `
|
42
46
|
"<!-- wp:quote -->
|
43
|
-
<blockquote class=\\"wp-block-quote\\"
|
47
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:heading -->
|
48
|
+
<h2>test</h2>
|
49
|
+
<!-- /wp:heading --></blockquote>
|
44
50
|
<!-- /wp:quote -->"
|
45
51
|
`;
|
46
52
|
|
47
53
|
exports[`Quote can be created by converting a paragraph 1`] = `
|
48
54
|
"<!-- wp:quote -->
|
49
|
-
<blockquote class=\\"wp-block-quote\\"
|
55
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
56
|
+
<p>test</p>
|
57
|
+
<!-- /wp:paragraph --></blockquote>
|
50
58
|
<!-- /wp:quote -->"
|
51
59
|
`;
|
52
60
|
|
53
61
|
exports[`Quote can be created by converting multiple paragraphs 1`] = `
|
54
62
|
"<!-- wp:quote -->
|
55
|
-
<blockquote class=\\"wp-block-quote\\"
|
63
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
64
|
+
<p>one</p>
|
65
|
+
<!-- /wp:paragraph -->
|
66
|
+
|
67
|
+
<!-- wp:paragraph -->
|
68
|
+
<p>two</p>
|
69
|
+
<!-- /wp:paragraph --></blockquote>
|
56
70
|
<!-- /wp:quote -->"
|
57
71
|
`;
|
58
72
|
|
59
73
|
exports[`Quote can be created by typing "/quote" 1`] = `
|
60
74
|
"<!-- wp:quote -->
|
61
|
-
<blockquote class=\\"wp-block-quote\\"
|
75
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
76
|
+
<p>I’m a quote</p>
|
77
|
+
<!-- /wp:paragraph --></blockquote>
|
62
78
|
<!-- /wp:quote -->"
|
63
79
|
`;
|
64
80
|
|
65
81
|
exports[`Quote can be created by typing > in front of text of a paragraph block 1`] = `
|
66
82
|
"<!-- wp:quote -->
|
67
|
-
<blockquote class=\\"wp-block-quote\\"
|
83
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
84
|
+
<p>test</p>
|
85
|
+
<!-- /wp:paragraph --></blockquote>
|
68
86
|
<!-- /wp:quote -->"
|
69
87
|
`;
|
70
88
|
|
71
89
|
exports[`Quote can be created by using > at the start of a paragraph block 1`] = `
|
72
90
|
"<!-- wp:quote -->
|
73
|
-
<blockquote class=\\"wp-block-quote\\"
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
exports[`Quote can be merged into from a paragraph 1`] = `
|
78
|
-
"<!-- wp:quote -->
|
79
|
-
<blockquote class=\\"wp-block-quote\\"><p>test</p></blockquote>
|
80
|
-
<!-- /wp:quote -->"
|
81
|
-
`;
|
82
|
-
|
83
|
-
exports[`Quote can be split at the end and merged back 1`] = `
|
84
|
-
"<!-- wp:quote -->
|
85
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p></blockquote>
|
86
|
-
<!-- /wp:quote -->
|
91
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
92
|
+
<p>A quote</p>
|
93
|
+
<!-- /wp:paragraph -->
|
87
94
|
|
88
95
|
<!-- wp:paragraph -->
|
89
|
-
<p
|
90
|
-
<!-- /wp:paragraph
|
91
|
-
`;
|
92
|
-
|
93
|
-
exports[`Quote can be split at the end and merged back 2`] = `
|
94
|
-
"<!-- wp:quote -->
|
95
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p><p></p></blockquote>
|
96
|
+
<p>Another paragraph</p>
|
97
|
+
<!-- /wp:paragraph --></blockquote>
|
96
98
|
<!-- /wp:quote -->"
|
97
99
|
`;
|
98
100
|
|
99
|
-
exports[`Quote can be split at the end
|
101
|
+
exports[`Quote can be split at the end 1`] = `
|
100
102
|
"<!-- wp:quote -->
|
101
|
-
<blockquote class=\\"wp-block-quote\\"
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
exports[`Quote can be split in the middle and merged back 1`] = `
|
106
|
-
"<!-- wp:quote -->
|
107
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p><cite>c</cite></blockquote>
|
103
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
104
|
+
<p>1</p>
|
105
|
+
<!-- /wp:paragraph --></blockquote>
|
108
106
|
<!-- /wp:quote -->
|
109
107
|
|
110
108
|
<!-- wp:paragraph -->
|
111
109
|
<p></p>
|
112
|
-
<!-- /wp:paragraph -->
|
113
|
-
|
114
|
-
<!-- wp:quote -->
|
115
|
-
<blockquote class=\\"wp-block-quote\\"><p>2</p><cite>c</cite></blockquote>
|
116
|
-
<!-- /wp:quote -->"
|
117
|
-
`;
|
118
|
-
|
119
|
-
exports[`Quote can be split in the middle and merged back 2`] = `
|
120
|
-
"<!-- wp:quote -->
|
121
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p><p></p><cite>c</cite></blockquote>
|
122
|
-
<!-- /wp:quote -->
|
123
|
-
|
124
|
-
<!-- wp:quote -->
|
125
|
-
<blockquote class=\\"wp-block-quote\\"><p>2</p><cite>c</cite></blockquote>
|
126
|
-
<!-- /wp:quote -->"
|
127
|
-
`;
|
128
|
-
|
129
|
-
exports[`Quote can be split in the middle and merged back 3`] = `
|
130
|
-
"<!-- wp:quote -->
|
131
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p><cite>c</cite></blockquote>
|
132
|
-
<!-- /wp:quote -->
|
133
|
-
|
134
|
-
<!-- wp:quote -->
|
135
|
-
<blockquote class=\\"wp-block-quote\\"><p>2</p><cite>c</cite></blockquote>
|
136
|
-
<!-- /wp:quote -->"
|
110
|
+
<!-- /wp:paragraph -->"
|
137
111
|
`;
|
138
112
|
|
139
|
-
exports[`Quote can be split
|
113
|
+
exports[`Quote can be split at the end 2`] = `
|
140
114
|
"<!-- wp:quote -->
|
141
|
-
<blockquote class=\\"wp-block-quote\\"
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
exports[`Quote is transformed to a heading and a quote if the quote contains a citation 1`] = `
|
146
|
-
"<!-- wp:heading -->
|
147
|
-
<h2>one</h2>
|
148
|
-
<!-- /wp:heading -->
|
149
|
-
|
150
|
-
<!-- wp:quote -->
|
151
|
-
<blockquote class=\\"wp-block-quote\\"><p></p><cite>cite</cite></blockquote>
|
152
|
-
<!-- /wp:quote -->"
|
153
|
-
`;
|
154
|
-
|
155
|
-
exports[`Quote is transformed to a heading and a quote if the quote contains multiple paragraphs 1`] = `
|
156
|
-
"<!-- wp:heading -->
|
157
|
-
<h2>one</h2>
|
158
|
-
<!-- /wp:heading -->
|
159
|
-
|
160
|
-
<!-- wp:quote -->
|
161
|
-
<blockquote class=\\"wp-block-quote\\"><p>two</p><p>three</p></blockquote>
|
115
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
116
|
+
<p>1</p>
|
117
|
+
<!-- /wp:paragraph --></blockquote>
|
162
118
|
<!-- /wp:quote -->"
|
163
119
|
`;
|
164
|
-
|
165
|
-
exports[`Quote is transformed to a heading if the quote just contains one paragraph 1`] = `
|
166
|
-
"<!-- wp:heading -->
|
167
|
-
<h2>one</h2>
|
168
|
-
<!-- /wp:heading -->"
|
169
|
-
`;
|
170
|
-
|
171
|
-
exports[`Quote is transformed to an empty heading if the quote is empty 1`] = `
|
172
|
-
"<!-- wp:heading -->
|
173
|
-
<h2></h2>
|
174
|
-
<!-- /wp:heading -->"
|
175
|
-
`;
|
176
|
-
|
177
|
-
exports[`Quote the resuling quote after transforming to a heading can be transformed again 1`] = `
|
178
|
-
"<!-- wp:heading -->
|
179
|
-
<h2>one</h2>
|
180
|
-
<!-- /wp:heading -->
|
181
|
-
|
182
|
-
<!-- wp:quote -->
|
183
|
-
<blockquote class=\\"wp-block-quote\\"><p>two</p><cite>cite</cite></blockquote>
|
184
|
-
<!-- /wp:quote -->"
|
185
|
-
`;
|
186
|
-
|
187
|
-
exports[`Quote the resuling quote after transforming to a heading can be transformed again 2`] = `
|
188
|
-
"<!-- wp:heading -->
|
189
|
-
<h2>one</h2>
|
190
|
-
<!-- /wp:heading -->
|
191
|
-
|
192
|
-
<!-- wp:heading -->
|
193
|
-
<h2>two</h2>
|
194
|
-
<!-- /wp:heading -->
|
195
|
-
|
196
|
-
<!-- wp:quote -->
|
197
|
-
<blockquote class=\\"wp-block-quote\\"><p></p><cite>cite</cite></blockquote>
|
198
|
-
<!-- /wp:quote -->"
|
199
|
-
`;
|
200
|
-
|
201
|
-
exports[`Quote the resuling quote after transforming to a heading can be transformed again 3`] = `
|
202
|
-
"<!-- wp:heading -->
|
203
|
-
<h2>one</h2>
|
204
|
-
<!-- /wp:heading -->
|
205
|
-
|
206
|
-
<!-- wp:heading -->
|
207
|
-
<h2>two</h2>
|
208
|
-
<!-- /wp:heading -->
|
209
|
-
|
210
|
-
<!-- wp:heading -->
|
211
|
-
<h2>cite</h2>
|
212
|
-
<!-- /wp:heading -->"
|
213
|
-
`;
|
@@ -1317,9 +1317,10 @@ Expected mock function not to be called but it was called with: ["POST", "http:/
|
|
1317
1317
|
await switchUserToAdmin();
|
1318
1318
|
} );
|
1319
1319
|
|
1320
|
-
it( 'shows a warning if user does not have permission to create navigation menus', async () => {
|
1320
|
+
it.skip( 'shows a warning if user does not have permission to create navigation menus', async () => {
|
1321
1321
|
const noticeText =
|
1322
1322
|
'You do not have permission to create Navigation Menus.';
|
1323
|
+
|
1323
1324
|
// Switch to a Contributor role user - they should not have
|
1324
1325
|
// permission to update Navigations.
|
1325
1326
|
await loginUser( contributorUsername, contributorPassword );
|
@@ -77,7 +77,9 @@ describe( 'Quote', () => {
|
|
77
77
|
await page.keyboard.type( 'one' );
|
78
78
|
await page.keyboard.press( 'Enter' );
|
79
79
|
await page.keyboard.type( 'two' );
|
80
|
-
|
80
|
+
// Navigate to the citation to select the block.
|
81
|
+
await page.keyboard.press( 'ArrowRight' );
|
82
|
+
await transformBlockTo( 'Unwrap' );
|
81
83
|
|
82
84
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
83
85
|
} );
|
@@ -89,7 +91,7 @@ describe( 'Quote', () => {
|
|
89
91
|
await page.keyboard.type( 'two' );
|
90
92
|
await page.keyboard.press( 'ArrowRight' );
|
91
93
|
await page.keyboard.type( 'cite' );
|
92
|
-
await transformBlockTo( '
|
94
|
+
await transformBlockTo( 'Unwrap' );
|
93
95
|
|
94
96
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
95
97
|
} );
|
@@ -98,14 +100,15 @@ describe( 'Quote', () => {
|
|
98
100
|
await insertBlock( 'Quote' );
|
99
101
|
await page.keyboard.press( 'ArrowRight' );
|
100
102
|
await page.keyboard.type( 'cite' );
|
101
|
-
await transformBlockTo( '
|
103
|
+
await transformBlockTo( 'Unwrap' );
|
102
104
|
|
103
105
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
104
106
|
} );
|
105
107
|
|
106
108
|
it( 'and renders a void paragraph if both the cite and quote are void', async () => {
|
107
109
|
await insertBlock( 'Quote' );
|
108
|
-
await
|
110
|
+
await page.keyboard.press( 'ArrowRight' ); // Select the quote
|
111
|
+
await transformBlockTo( 'Unwrap' );
|
109
112
|
|
110
113
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
111
114
|
} );
|
@@ -119,56 +122,6 @@ describe( 'Quote', () => {
|
|
119
122
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
120
123
|
} );
|
121
124
|
|
122
|
-
it( 'is transformed to an empty heading if the quote is empty', async () => {
|
123
|
-
await insertBlock( 'Quote' );
|
124
|
-
await transformBlockTo( 'Heading' );
|
125
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
126
|
-
} );
|
127
|
-
|
128
|
-
it( 'is transformed to a heading if the quote just contains one paragraph', async () => {
|
129
|
-
await insertBlock( 'Quote' );
|
130
|
-
await page.keyboard.type( 'one' );
|
131
|
-
await transformBlockTo( 'Heading' );
|
132
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
133
|
-
} );
|
134
|
-
|
135
|
-
it( 'is transformed to a heading and a quote if the quote contains multiple paragraphs', async () => {
|
136
|
-
await insertBlock( 'Quote' );
|
137
|
-
await page.keyboard.type( 'one' );
|
138
|
-
await page.keyboard.press( 'Enter' );
|
139
|
-
await page.keyboard.type( 'two' );
|
140
|
-
await page.keyboard.press( 'Enter' );
|
141
|
-
await page.keyboard.type( 'three' );
|
142
|
-
await transformBlockTo( 'Heading' );
|
143
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
144
|
-
} );
|
145
|
-
|
146
|
-
it( 'is transformed to a heading and a quote if the quote contains a citation', async () => {
|
147
|
-
await insertBlock( 'Quote' );
|
148
|
-
await page.keyboard.type( 'one' );
|
149
|
-
await page.keyboard.press( 'ArrowRight' );
|
150
|
-
await page.keyboard.type( 'cite' );
|
151
|
-
await transformBlockTo( 'Heading' );
|
152
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
153
|
-
} );
|
154
|
-
|
155
|
-
it( 'the resuling quote after transforming to a heading can be transformed again', async () => {
|
156
|
-
await insertBlock( 'Quote' );
|
157
|
-
await page.keyboard.type( 'one' );
|
158
|
-
await page.keyboard.press( 'Enter' );
|
159
|
-
await page.keyboard.type( 'two' );
|
160
|
-
await page.keyboard.press( 'ArrowRight' );
|
161
|
-
await page.keyboard.type( 'cite' );
|
162
|
-
await transformBlockTo( 'Heading' );
|
163
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
164
|
-
await page.click( '[data-type="core/quote"]' );
|
165
|
-
await transformBlockTo( 'Heading' );
|
166
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
167
|
-
await page.click( '[data-type="core/quote"]' );
|
168
|
-
await transformBlockTo( 'Heading' );
|
169
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
170
|
-
} );
|
171
|
-
|
172
125
|
it( 'can be converted to a pullquote', async () => {
|
173
126
|
await insertBlock( 'Quote' );
|
174
127
|
await page.keyboard.type( 'one' );
|
@@ -180,16 +133,7 @@ describe( 'Quote', () => {
|
|
180
133
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
181
134
|
} );
|
182
135
|
|
183
|
-
it( 'can be
|
184
|
-
await insertBlock( 'Quote' );
|
185
|
-
await insertBlock( 'Paragraph' );
|
186
|
-
await page.keyboard.type( 'test' );
|
187
|
-
await pressKeyTimes( 'ArrowLeft', 'test'.length );
|
188
|
-
await page.keyboard.press( 'Backspace' );
|
189
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
190
|
-
} );
|
191
|
-
|
192
|
-
it( 'can be split at the end and merged back', async () => {
|
136
|
+
it( 'can be split at the end', async () => {
|
193
137
|
await insertBlock( 'Quote' );
|
194
138
|
await page.keyboard.type( '1' );
|
195
139
|
await page.keyboard.press( 'Enter' );
|
@@ -200,46 +144,7 @@ describe( 'Quote', () => {
|
|
200
144
|
|
201
145
|
await page.keyboard.press( 'Backspace' );
|
202
146
|
|
203
|
-
// Expect
|
204
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
205
|
-
|
206
|
-
await page.keyboard.press( 'Backspace' );
|
207
|
-
|
208
|
-
// Expect quote without empty paragraphs.
|
209
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
210
|
-
} );
|
211
|
-
|
212
|
-
it( 'can be split in the middle and merged back', async () => {
|
213
|
-
await insertBlock( 'Quote' );
|
214
|
-
await page.keyboard.type( '1' );
|
215
|
-
await page.keyboard.press( 'Enter' );
|
216
|
-
await page.keyboard.type( '2' );
|
217
|
-
await page.keyboard.press( 'ArrowRight' );
|
218
|
-
await page.keyboard.type( 'c' );
|
219
|
-
await page.keyboard.press( 'ArrowUp' );
|
220
|
-
await page.keyboard.press( 'ArrowUp' );
|
221
|
-
await page.keyboard.press( 'Enter' );
|
222
|
-
await page.keyboard.press( 'Enter' );
|
223
|
-
|
224
|
-
// Expect two quote blocks and empty paragraph in the middle.
|
225
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
226
|
-
|
227
|
-
await page.keyboard.press( 'Backspace' );
|
228
|
-
|
229
|
-
// Expect two quote blocks and empty paragraph in the first quote.
|
230
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
231
|
-
|
232
|
-
await page.keyboard.press( 'Backspace' );
|
233
|
-
|
234
|
-
// Expect two quote blocks.
|
235
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
236
|
-
|
237
|
-
await page.keyboard.press( 'ArrowLeft' );
|
238
|
-
await page.keyboard.press( 'ArrowDown' );
|
239
|
-
await page.keyboard.press( 'ArrowDown' );
|
240
|
-
await page.keyboard.press( 'ArrowDown' );
|
241
|
-
await page.keyboard.press( 'Backspace' );
|
242
|
-
|
147
|
+
// Expect the paragraph to be deleted.
|
243
148
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
244
149
|
} );
|
245
150
|
} );
|
@@ -10,7 +10,9 @@ exports[`cpt locking template_lock all should insert line breaks when using ente
|
|
10
10
|
<!-- /wp:paragraph -->
|
11
11
|
|
12
12
|
<!-- wp:quote -->
|
13
|
-
<blockquote class=\\"wp-block-quote\\"
|
13
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
14
|
+
<p></p>
|
15
|
+
<!-- /wp:paragraph --></blockquote>
|
14
16
|
<!-- /wp:quote -->
|
15
17
|
|
16
18
|
<!-- wp:columns -->
|
@@ -28,7 +30,9 @@ exports[`cpt locking template_lock all should not error when deleting the cotent
|
|
28
30
|
<!-- /wp:paragraph -->
|
29
31
|
|
30
32
|
<!-- wp:quote -->
|
31
|
-
<blockquote class=\\"wp-block-quote\\"
|
33
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
34
|
+
<p></p>
|
35
|
+
<!-- /wp:paragraph --></blockquote>
|
32
36
|
<!-- /wp:quote -->
|
33
37
|
|
34
38
|
<!-- wp:columns -->
|
@@ -43,7 +47,9 @@ exports[`cpt locking template_lock all unlocked group should allow blocks to be
|
|
43
47
|
<!-- /wp:paragraph -->
|
44
48
|
|
45
49
|
<!-- wp:quote -->
|
46
|
-
<blockquote class=\\"wp-block-quote\\"
|
50
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
51
|
+
<p></p>
|
52
|
+
<!-- /wp:paragraph --></blockquote>
|
47
53
|
<!-- /wp:quote --></div>
|
48
54
|
<!-- /wp:group -->"
|
49
55
|
`;
|
@@ -51,7 +57,9 @@ exports[`cpt locking template_lock all unlocked group should allow blocks to be
|
|
51
57
|
exports[`cpt locking template_lock all unlocked group should allow blocks to be removed 1`] = `
|
52
58
|
"<!-- wp:group {\\"templateLock\\":false} -->
|
53
59
|
<div class=\\"wp-block-group\\"><!-- wp:quote -->
|
54
|
-
<blockquote class=\\"wp-block-quote\\"
|
60
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
61
|
+
<p></p>
|
62
|
+
<!-- /wp:paragraph --></blockquote>
|
55
63
|
<!-- /wp:quote --></div>
|
56
64
|
<!-- /wp:group -->"
|
57
65
|
`;
|
@@ -66,7 +74,9 @@ exports[`cpt locking template_lock false should allow blocks to be inserted 1`]
|
|
66
74
|
<!-- /wp:paragraph -->
|
67
75
|
|
68
76
|
<!-- wp:quote -->
|
69
|
-
<blockquote class=\\"wp-block-quote\\"
|
77
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
78
|
+
<p></p>
|
79
|
+
<!-- /wp:paragraph --></blockquote>
|
70
80
|
<!-- /wp:quote -->
|
71
81
|
|
72
82
|
<!-- wp:columns -->
|
@@ -88,7 +98,9 @@ exports[`cpt locking template_lock false should allow blocks to be moved 1`] = `
|
|
88
98
|
<!-- /wp:image -->
|
89
99
|
|
90
100
|
<!-- wp:quote -->
|
91
|
-
<blockquote class=\\"wp-block-quote\\"
|
101
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
102
|
+
<p></p>
|
103
|
+
<!-- /wp:paragraph --></blockquote>
|
92
104
|
<!-- /wp:quote -->
|
93
105
|
|
94
106
|
<!-- wp:columns -->
|
@@ -102,7 +114,9 @@ exports[`cpt locking template_lock false should allow blocks to be removed 1`] =
|
|
102
114
|
<!-- /wp:image -->
|
103
115
|
|
104
116
|
<!-- wp:quote -->
|
105
|
-
<blockquote class=\\"wp-block-quote\\"
|
117
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
118
|
+
<p></p>
|
119
|
+
<!-- /wp:paragraph --></blockquote>
|
106
120
|
<!-- /wp:quote -->
|
107
121
|
|
108
122
|
<!-- wp:columns -->
|
@@ -120,7 +134,9 @@ exports[`cpt locking template_lock insert should allow blocks to be moved 1`] =
|
|
120
134
|
<!-- /wp:image -->
|
121
135
|
|
122
136
|
<!-- wp:quote -->
|
123
|
-
<blockquote class=\\"wp-block-quote\\"
|
137
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
138
|
+
<p></p>
|
139
|
+
<!-- /wp:paragraph --></blockquote>
|
124
140
|
<!-- /wp:quote -->
|
125
141
|
|
126
142
|
<!-- wp:columns -->
|
@@ -3,7 +3,9 @@
|
|
3
3
|
exports[`RenderAppender prop of InnerBlocks Users can customize the appender and can still insert blocks using exposed components 1`] = `
|
4
4
|
"<!-- wp:test/inner-blocks-render-appender -->
|
5
5
|
<div style=\\"outline:1px solid gray;padding:5px\\" class=\\"wp-block-test-inner-blocks-render-appender\\"><!-- wp:quote -->
|
6
|
-
<blockquote class=\\"wp-block-quote\\"
|
6
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
7
|
+
<p></p>
|
8
|
+
<!-- /wp:paragraph --></blockquote>
|
7
9
|
<!-- /wp:quote --></div>
|
8
10
|
<!-- /wp:test/inner-blocks-render-appender -->"
|
9
11
|
`;
|
@@ -11,7 +13,9 @@ exports[`RenderAppender prop of InnerBlocks Users can customize the appender and
|
|
11
13
|
exports[`RenderAppender prop of InnerBlocks Users can dynamically customize the appender 1`] = `
|
12
14
|
"<!-- wp:test/inner-blocks-render-appender-dynamic -->
|
13
15
|
<div style=\\"outline:1px solid gray;padding:5px\\" class=\\"wp-block-test-inner-blocks-render-appender-dynamic\\"><!-- wp:quote -->
|
14
|
-
<blockquote class=\\"wp-block-quote\\"
|
16
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
17
|
+
<p></p>
|
18
|
+
<!-- /wp:paragraph --></blockquote>
|
15
19
|
<!-- /wp:quote -->
|
16
20
|
|
17
21
|
<!-- wp:video -->
|
@@ -10,7 +10,9 @@ exports[`templates Using a CPT with a predefined template Should add a custom po
|
|
10
10
|
<!-- /wp:paragraph -->
|
11
11
|
|
12
12
|
<!-- wp:quote -->
|
13
|
-
<blockquote class=\\"wp-block-quote\\"
|
13
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
14
|
+
<p></p>
|
15
|
+
<!-- /wp:paragraph --></blockquote>
|
14
16
|
<!-- /wp:quote -->
|
15
17
|
|
16
18
|
<!-- wp:columns -->
|
@@ -36,7 +38,9 @@ exports[`templates Using a CPT with a predefined template Should respect user ed
|
|
36
38
|
<!-- /wp:paragraph -->
|
37
39
|
|
38
40
|
<!-- wp:quote -->
|
39
|
-
<blockquote class=\\"wp-block-quote\\"
|
41
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
42
|
+
<p></p>
|
43
|
+
<!-- /wp:paragraph --></blockquote>
|
40
44
|
<!-- /wp:quote -->
|
41
45
|
|
42
46
|
<!-- wp:columns -->
|
@@ -148,6 +148,8 @@ describe( 'Block variations', () => {
|
|
148
148
|
|
149
149
|
it( 'should show block information when no matching variation is found', async () => {
|
150
150
|
await insertBlock( 'Large Quote' );
|
151
|
+
// Select the quote block.
|
152
|
+
await page.keyboard.press( 'ArrowDown' );
|
151
153
|
const breadcrumb = await getActiveBreadcrumb();
|
152
154
|
expect( breadcrumb ).toEqual( 'Quote' );
|
153
155
|
const navigationItem = await getFirstNavigationItem();
|
@@ -49,12 +49,12 @@ describe( 'cpt locking', () => {
|
|
49
49
|
|
50
50
|
const shouldAllowBlocksToBeMoved = async () => {
|
51
51
|
await page.click(
|
52
|
-
'.block-editor-rich-text__editable[data-type="core/paragraph"]'
|
52
|
+
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]'
|
53
53
|
);
|
54
54
|
expect( await page.$( 'button[aria-label="Move up"]' ) ).not.toBeNull();
|
55
55
|
await page.click( 'button[aria-label="Move up"]' );
|
56
56
|
await page.type(
|
57
|
-
'.block-editor-rich-text__editable[data-type="core/paragraph"]',
|
57
|
+
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]',
|
58
58
|
'p1'
|
59
59
|
);
|
60
60
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
@@ -193,7 +193,7 @@ describe( 'cpt locking', () => {
|
|
193
193
|
|
194
194
|
it( 'should allow blocks to be removed', async () => {
|
195
195
|
await page.type(
|
196
|
-
'.block-editor-rich-text__editable[data-type="core/paragraph"]',
|
196
|
+
'div > .block-editor-rich-text__editable[data-type="core/paragraph"]',
|
197
197
|
'p1'
|
198
198
|
);
|
199
199
|
await clickBlockToolbarButton( 'Options' );
|
@@ -98,6 +98,9 @@ describe( 'RenderAppender prop of InnerBlocks', () => {
|
|
98
98
|
// Insert a quote block.
|
99
99
|
await quoteButton.click();
|
100
100
|
|
101
|
+
// Select the quote block.
|
102
|
+
await page.keyboard.press( 'ArrowDown' );
|
103
|
+
|
101
104
|
// Verify if the custom block appender text changed as expected.
|
102
105
|
await page.waitForXPath(
|
103
106
|
`//*[contains(@class, "${ DYNAMIC_APPENDER_SELECTOR }")]/span[contains(@class, "single-blocks-appender")][contains(text(), "Single Blocks Appender")]`
|
@@ -146,22 +146,6 @@ exports[`Multi-block selection should handle Enter across blocks 2`] = `
|
|
146
146
|
<!-- /wp:heading -->"
|
147
147
|
`;
|
148
148
|
|
149
|
-
exports[`Multi-block selection should merge into quote with correct selection 1`] = `
|
150
|
-
"<!-- wp:quote -->
|
151
|
-
<blockquote class=\\"wp-block-quote\\"><p>1[</p></blockquote>
|
152
|
-
<!-- /wp:quote -->
|
153
|
-
|
154
|
-
<!-- wp:paragraph -->
|
155
|
-
<p>]2</p>
|
156
|
-
<!-- /wp:paragraph -->"
|
157
|
-
`;
|
158
|
-
|
159
|
-
exports[`Multi-block selection should merge into quote with correct selection 2`] = `
|
160
|
-
"<!-- wp:quote -->
|
161
|
-
<blockquote class=\\"wp-block-quote\\"><p>1</p><p>&2</p></blockquote>
|
162
|
-
<!-- /wp:quote -->"
|
163
|
-
`;
|
164
|
-
|
165
149
|
exports[`Multi-block selection should multi-select from within the list block 1`] = `
|
166
150
|
"<!-- wp:paragraph -->
|
167
151
|
<p>1</p>
|
@@ -207,9 +207,9 @@ exports[`Writing Flow should navigate empty paragraphs 1`] = `
|
|
207
207
|
`;
|
208
208
|
|
209
209
|
exports[`Writing Flow should not create extra line breaks in multiline value 1`] = `
|
210
|
-
"<!-- wp:
|
211
|
-
<
|
212
|
-
<!-- /wp:
|
210
|
+
"<!-- wp:list -->
|
211
|
+
<ul><li></li></ul>
|
212
|
+
<!-- /wp:list -->"
|
213
213
|
`;
|
214
214
|
|
215
215
|
exports[`Writing Flow should not delete surrounding space when deleting a selected word 1`] = `
|
@@ -28,9 +28,8 @@ describe( 'Block Switcher', () => {
|
|
28
28
|
expect.arrayContaining( [
|
29
29
|
'Group',
|
30
30
|
'Paragraph',
|
31
|
-
'Quote',
|
32
31
|
'Heading',
|
33
|
-
'
|
32
|
+
'Quote',
|
34
33
|
'Columns',
|
35
34
|
'Table of Contents',
|
36
35
|
] )
|
@@ -56,7 +55,6 @@ describe( 'Block Switcher', () => {
|
|
56
55
|
expect.arrayContaining( [
|
57
56
|
'Group',
|
58
57
|
'Paragraph',
|
59
|
-
'Pullquote',
|
60
58
|
'Heading',
|
61
59
|
'Table of Contents',
|
62
60
|
] )
|
@@ -718,9 +718,8 @@ describe( 'Multi-block selection', () => {
|
|
718
718
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
719
719
|
|
720
720
|
// Clear the selected block.
|
721
|
-
|
722
|
-
|
723
|
-
await page.mouse.click( box.x - 1, box.y );
|
721
|
+
await page.keyboard.press( 'Escape' );
|
722
|
+
await page.keyboard.press( 'Escape' );
|
724
723
|
|
725
724
|
await pressKeyWithModifier( 'primary', 'a' );
|
726
725
|
|
@@ -906,30 +905,6 @@ describe( 'Multi-block selection', () => {
|
|
906
905
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
907
906
|
} );
|
908
907
|
|
909
|
-
it( 'should merge into quote with correct selection', async () => {
|
910
|
-
await clickBlockAppender();
|
911
|
-
await page.keyboard.type( '> 1[' );
|
912
|
-
await page.keyboard.press( 'Enter' );
|
913
|
-
await page.keyboard.press( 'Enter' );
|
914
|
-
await page.keyboard.type( ']2' );
|
915
|
-
await page.keyboard.press( 'ArrowLeft' );
|
916
|
-
// Select everything between [].
|
917
|
-
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
918
|
-
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
919
|
-
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
|
920
|
-
|
921
|
-
// Test setup.
|
922
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
923
|
-
|
924
|
-
await page.keyboard.press( 'Backspace' );
|
925
|
-
|
926
|
-
// Ensure selection is in the correct place.
|
927
|
-
await page.keyboard.type( '&' );
|
928
|
-
|
929
|
-
// Expect two blocks with "&" in between.
|
930
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
931
|
-
} );
|
932
|
-
|
933
908
|
it( 'should select separator (single element block)', async () => {
|
934
909
|
await clickBlockAppender();
|
935
910
|
await page.keyboard.type( '/hr' );
|
@@ -364,6 +364,8 @@ describe( 'Reusable blocks', () => {
|
|
364
364
|
'.block-editor-block-list__block[aria-label="Block: Quote"]'
|
365
365
|
);
|
366
366
|
await quoteBlock.click();
|
367
|
+
// Select the quote block.
|
368
|
+
await page.keyboard.press( 'ArrowDown' );
|
367
369
|
await openDocumentSettingsSidebar();
|
368
370
|
await page.waitForXPath(
|
369
371
|
'//*[@role="region"][@aria-label="Editor settings"]//button[.="Styles"]'
|
@@ -282,7 +282,7 @@ describe( 'Writing Flow', () => {
|
|
282
282
|
} );
|
283
283
|
|
284
284
|
it( 'should not create extra line breaks in multiline value', async () => {
|
285
|
-
await insertBlock( '
|
285
|
+
await insertBlock( 'List' );
|
286
286
|
await page.keyboard.type( 'a' );
|
287
287
|
await page.keyboard.press( 'Backspace' );
|
288
288
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
@@ -753,4 +753,77 @@ describe( 'Writing Flow', () => {
|
|
753
753
|
);
|
754
754
|
expect( paragraphs ).toEqual( [ 'first', 'second' ] );
|
755
755
|
} );
|
756
|
+
|
757
|
+
it( 'should move to the start of the first line on ArrowUp', async () => {
|
758
|
+
await page.keyboard.press( 'Enter' );
|
759
|
+
await page.keyboard.type( 'a' );
|
760
|
+
|
761
|
+
async function getHeight() {
|
762
|
+
return await page.evaluate(
|
763
|
+
() => document.activeElement.offsetHeight
|
764
|
+
);
|
765
|
+
}
|
766
|
+
|
767
|
+
const height = await getHeight();
|
768
|
+
|
769
|
+
// Keep typing until the height of the element increases. We need two
|
770
|
+
// lines.
|
771
|
+
while ( height === ( await getHeight() ) ) {
|
772
|
+
await page.keyboard.type( 'a' );
|
773
|
+
}
|
774
|
+
|
775
|
+
// Move to the start of the second line.
|
776
|
+
await page.keyboard.press( 'ArrowLeft' );
|
777
|
+
// Move to the start of the first line.
|
778
|
+
await page.keyboard.press( 'ArrowUp' );
|
779
|
+
// Insert a "." for testing.
|
780
|
+
await page.keyboard.type( '.' );
|
781
|
+
|
782
|
+
// Expect the "." to be added at the start of the paragraph.
|
783
|
+
expect(
|
784
|
+
await page.evaluate( () =>
|
785
|
+
document.activeElement.getAttribute( 'data-type' )
|
786
|
+
)
|
787
|
+
).toBe( 'core/paragraph' );
|
788
|
+
expect(
|
789
|
+
await page.evaluate( () => document.activeElement.textContent )
|
790
|
+
).toMatch( /^\.a+$/ );
|
791
|
+
} );
|
792
|
+
|
793
|
+
it( 'should vertically move the caret from corner to corner', async () => {
|
794
|
+
await page.keyboard.press( 'Enter' );
|
795
|
+
await page.keyboard.type( 'a' );
|
796
|
+
|
797
|
+
async function getHeight() {
|
798
|
+
return await page.evaluate(
|
799
|
+
() => document.activeElement.offsetHeight
|
800
|
+
);
|
801
|
+
}
|
802
|
+
|
803
|
+
const height = await getHeight();
|
804
|
+
|
805
|
+
// Keep typing until the height of the element increases. We need two
|
806
|
+
// lines.
|
807
|
+
while ( height === ( await getHeight() ) ) {
|
808
|
+
await page.keyboard.type( 'a' );
|
809
|
+
}
|
810
|
+
|
811
|
+
// Create a new paragraph.
|
812
|
+
await page.keyboard.press( 'Enter' );
|
813
|
+
// Move to the start of the first line.
|
814
|
+
await page.keyboard.press( 'ArrowUp' );
|
815
|
+
// Insert a "." for testing.
|
816
|
+
await page.keyboard.type( '.' );
|
817
|
+
|
818
|
+
// Expect the "." to be added at the start of the second line.
|
819
|
+
// It should not be added to the first line!
|
820
|
+
expect(
|
821
|
+
await page.evaluate( () =>
|
822
|
+
document.activeElement.getAttribute( 'data-type' )
|
823
|
+
)
|
824
|
+
).toBe( 'core/paragraph' );
|
825
|
+
expect(
|
826
|
+
await page.evaluate( () => document.activeElement.textContent )
|
827
|
+
).toMatch( /^a+\.a$/ );
|
828
|
+
} );
|
756
829
|
} );
|
@@ -1,44 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
activatePlugin,
|
6
|
-
clickBlockAppender,
|
7
|
-
createNewPost,
|
8
|
-
deactivatePlugin,
|
9
|
-
getEditedPostContent,
|
10
|
-
} from '@wordpress/e2e-test-utils';
|
11
|
-
|
12
|
-
describe( 'Using Hooks API', () => {
|
13
|
-
beforeAll( async () => {
|
14
|
-
await activatePlugin( 'gutenberg-test-hooks-api' );
|
15
|
-
} );
|
16
|
-
|
17
|
-
afterAll( async () => {
|
18
|
-
await deactivatePlugin( 'gutenberg-test-hooks-api' );
|
19
|
-
} );
|
20
|
-
|
21
|
-
beforeEach( async () => {
|
22
|
-
await createNewPost();
|
23
|
-
} );
|
24
|
-
|
25
|
-
it( 'Should contain a reset block button on the sidebar', async () => {
|
26
|
-
await clickBlockAppender();
|
27
|
-
await page.keyboard.type( 'First paragraph' );
|
28
|
-
expect(
|
29
|
-
await page.$( '.edit-post-sidebar .e2e-reset-block-button' )
|
30
|
-
).not.toBeNull();
|
31
|
-
} );
|
32
|
-
|
33
|
-
it( 'Pressing reset block button resets the block', async () => {
|
34
|
-
await clickBlockAppender();
|
35
|
-
await page.keyboard.type( 'First paragraph' );
|
36
|
-
const paragraphContent = await page.$eval(
|
37
|
-
'p[data-type="core/paragraph"]',
|
38
|
-
( element ) => element.textContent
|
39
|
-
);
|
40
|
-
expect( paragraphContent ).toEqual( 'First paragraph' );
|
41
|
-
await page.click( '.edit-post-sidebar .e2e-reset-block-button' );
|
42
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
43
|
-
} );
|
44
|
-
} );
|