@wordpress/e2e-tests 4.6.0 → 4.9.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/README.md +8 -8
- package/package.json +7 -7
- package/plugins/cpt-locking.php +28 -4
- package/specs/editor/blocks/__snapshots__/quote.test.js.snap +37 -131
- package/specs/editor/blocks/gallery.test.js +1 -1
- package/specs/editor/blocks/navigation.test.js +3 -38
- package/specs/editor/blocks/quote.test.js +42 -91
- 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/plugins/meta-boxes.test.js +1 -1
- package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +0 -16
- package/specs/editor/various/__snapshots__/rich-text.test.js.snap +12 -0
- package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +3 -3
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +1 -1
- package/specs/editor/various/block-switcher.test.js +1 -3
- package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
- package/specs/editor/various/links.test.js +3 -3
- package/specs/editor/various/multi-block-selection.test.js +2 -29
- package/specs/editor/various/post-visibility.test.js +4 -4
- package/specs/editor/various/reusable-blocks.test.js +4 -2
- package/specs/editor/various/rich-text.test.js +17 -0
- package/specs/editor/various/scheduling.test.js +2 -2
- package/specs/editor/various/{sidebar-permalink-panel.test.js → sidebar-permalink.test.js} +9 -19
- package/specs/editor/various/typewriter.test.js +2 -2
- package/specs/editor/various/writing-flow.test.js +74 -1
- package/specs/site-editor/multi-entity-saving.test.js +3 -3
- package/specs/editor/blocks/__snapshots__/group.test.js.snap +0 -21
- package/specs/editor/blocks/__snapshots__/list.test.js.snap +0 -337
- package/specs/editor/blocks/comments.test.js +0 -131
- package/specs/editor/blocks/group.test.js +0 -43
- package/specs/editor/blocks/list.test.js +0 -542
- package/specs/editor/blocks/missing.test.js +0 -44
- package/specs/editor/plugins/__snapshots__/deprecated-node-matcher.test.js.snap +0 -13
- package/specs/editor/plugins/__snapshots__/format-api.test.js.snap +0 -7
- package/specs/editor/plugins/__snapshots__/hooks-api.test.js.snap +0 -3
- package/specs/editor/plugins/deprecated-node-matcher.test.js +0 -44
- package/specs/editor/plugins/format-api.test.js +0 -36
- package/specs/editor/plugins/hooks-api.test.js +0 -44
- package/specs/editor/various/__snapshots__/convert-block-type.test.js.snap +0 -13
- package/specs/editor/various/block-mover.test.js +0 -42
- package/specs/editor/various/convert-block-type.test.js +0 -32
package/README.md
CHANGED
@@ -18,30 +18,30 @@ The following commands are available on the Gutenberg repo:
|
|
18
18
|
|
19
19
|
```json
|
20
20
|
{
|
21
|
-
"test
|
22
|
-
"test
|
23
|
-
"test
|
21
|
+
"test:e2e": "wp-scripts test-e2e --config packages/e2e-tests/jest.config.js",
|
22
|
+
"test:e2e:debug": "wp-scripts --inspect-brk test-e2e --config packages/e2e-tests/jest.config.js --puppeteer-devtools",
|
23
|
+
"test:e2e:watch": "npm run test:e2e -- --watch"
|
24
24
|
}
|
25
25
|
```
|
26
26
|
|
27
27
|
### Run all available tests
|
28
28
|
|
29
29
|
```bash
|
30
|
-
npm run test
|
30
|
+
npm run test:e2e
|
31
31
|
```
|
32
32
|
|
33
33
|
### Run all available tests and listen for changes.
|
34
34
|
|
35
35
|
```bash
|
36
|
-
npm run test
|
36
|
+
npm run test:e2e:watch
|
37
37
|
```
|
38
38
|
|
39
39
|
### Run a specific test file
|
40
40
|
|
41
41
|
```bash
|
42
|
-
npm run test
|
42
|
+
npm run test:e2e -- packages/e2e-test/<path_to_test_file>
|
43
43
|
# Or, in order to watch for changes:
|
44
|
-
npm run test
|
44
|
+
npm run test:e2e:watch -- packages/e2e-test/<path_to_test_file>
|
45
45
|
```
|
46
46
|
|
47
47
|
### Debugging
|
@@ -49,7 +49,7 @@ npm run test-e2e:watch -- packages/e2e-test/<path_to_test_file>
|
|
49
49
|
Makes e2e tests available to debug in a Chrome Browser.
|
50
50
|
|
51
51
|
```bash
|
52
|
-
npm run test
|
52
|
+
npm run test:e2e:debug
|
53
53
|
```
|
54
54
|
|
55
55
|
After running the command, tests will be available for debugging in Chrome by going to chrome://inspect/#devices and clicking `inspect` under the path to `/test-e2e.js`.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@wordpress/e2e-tests",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.9.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.
|
27
|
-
"@wordpress/jest-console": "^5.
|
28
|
-
"@wordpress/jest-puppeteer-axe": "^4.0
|
29
|
-
"@wordpress/scripts": "^23.
|
30
|
-
"@wordpress/url": "^3.
|
26
|
+
"@wordpress/e2e-test-utils": "^7.11.0",
|
27
|
+
"@wordpress/jest-console": "^5.4.0",
|
28
|
+
"@wordpress/jest-puppeteer-axe": "^4.1.0",
|
29
|
+
"@wordpress/scripts": "^23.7.0",
|
30
|
+
"@wordpress/url": "^3.16.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": "08358f53b627a15148c3a3e433cdf58cf8714aa4"
|
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
|
-
`;
|
@@ -103,7 +103,7 @@ describe( 'Gallery', () => {
|
|
103
103
|
// This xpath selects the anchor node for the block which has a child span which contains the text
|
104
104
|
// label of the block and then selects the expander span for that node.
|
105
105
|
const galleryExpander = await page.waitForXPath(
|
106
|
-
`//a[span[text()='Gallery']]/span[contains(@class, 'block-editor-list-view__expander')]`
|
106
|
+
`//a[.//span[text()='Gallery']]/span[contains(@class, 'block-editor-list-view__expander')]`
|
107
107
|
);
|
108
108
|
|
109
109
|
await galleryExpander.click();
|
@@ -1047,7 +1047,7 @@ Expected mock function not to be called but it was called with: ["POST", "http:/
|
|
1047
1047
|
await openListView();
|
1048
1048
|
|
1049
1049
|
const navExpander = await page.waitForXPath(
|
1050
|
-
`//a[span[text()='Navigation']]/span[contains(@class, 'block-editor-list-view__expander')]`
|
1050
|
+
`//a[.//span[text()='Navigation']]/span[contains(@class, 'block-editor-list-view__expander')]`
|
1051
1051
|
);
|
1052
1052
|
|
1053
1053
|
await navExpander.click();
|
@@ -1317,45 +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
|
1321
|
-
await createNewPost();
|
1322
|
-
await insertBlock( 'Navigation' );
|
1323
|
-
|
1324
|
-
const startEmptyButton = await page.waitForXPath(
|
1325
|
-
START_EMPTY_XPATH
|
1326
|
-
);
|
1327
|
-
|
1328
|
-
// This creates an empty Navigation post type entity.
|
1329
|
-
await startEmptyButton.click();
|
1330
|
-
|
1331
|
-
// Publishing the Post ensures the Navigation entity is saved.
|
1332
|
-
// The Post itself is irrelevant.
|
1333
|
-
await publishPost();
|
1334
|
-
|
1335
|
-
// Switch to a Contributor role user - they should not have
|
1336
|
-
// permission to update Navigation menus.
|
1337
|
-
await loginUser( contributorUsername, contributorPassword );
|
1338
|
-
|
1339
|
-
await createNewPost();
|
1340
|
-
|
1341
|
-
// At this point the block will automatically pick the first Navigation Menu
|
1342
|
-
// which will be the one created by the Admin User.
|
1343
|
-
await insertBlock( 'Navigation' );
|
1344
|
-
|
1345
|
-
// Make sure the snackbar error shows up.
|
1346
|
-
await page.waitForXPath(
|
1347
|
-
`//*[contains(@class, 'components-snackbar__content')][ text()="You do not have permission to edit this Menu. Any changes made will not be saved." ]`
|
1348
|
-
);
|
1349
|
-
|
1350
|
-
// Expect a console 403 for requests to:
|
1351
|
-
// * /wp/v2/settings?_locale=user
|
1352
|
-
// * /wp/v2/templates?context=edit&post_type=post&per_page=100&_locale=user
|
1353
|
-
expect( console ).toHaveErrored();
|
1354
|
-
} );
|
1355
|
-
|
1356
|
-
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 () => {
|
1357
1321
|
const noticeText =
|
1358
1322
|
'You do not have permission to create Navigation Menus.';
|
1323
|
+
|
1359
1324
|
// Switch to a Contributor role user - they should not have
|
1360
1325
|
// permission to update Navigations.
|
1361
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,53 @@ 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.
|
147
|
+
// Expect the paragraph to be deleted.
|
209
148
|
expect( await getEditedPostContent() ).toMatchSnapshot();
|
210
149
|
} );
|
211
150
|
|
212
|
-
it( 'can be
|
151
|
+
it( 'can be unwrapped on Backspace', async () => {
|
213
152
|
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
153
|
|
224
|
-
|
225
|
-
|
154
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
155
|
+
"<!-- wp:quote -->
|
156
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
157
|
+
<p></p>
|
158
|
+
<!-- /wp:paragraph --></blockquote>
|
159
|
+
<!-- /wp:quote -->"
|
160
|
+
` );
|
226
161
|
|
227
162
|
await page.keyboard.press( 'Backspace' );
|
228
163
|
|
229
|
-
|
230
|
-
|
164
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `""` );
|
165
|
+
} );
|
231
166
|
|
232
|
-
|
167
|
+
it( 'can be unwrapped with content on Backspace', async () => {
|
168
|
+
await insertBlock( 'Quote' );
|
169
|
+
await page.keyboard.type( '1' );
|
170
|
+
await page.keyboard.press( 'ArrowRight' );
|
171
|
+
await page.keyboard.type( '2' );
|
233
172
|
|
234
|
-
|
235
|
-
|
173
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
174
|
+
"<!-- wp:quote -->
|
175
|
+
<blockquote class=\\"wp-block-quote\\"><!-- wp:paragraph -->
|
176
|
+
<p>1</p>
|
177
|
+
<!-- /wp:paragraph --><cite>2</cite></blockquote>
|
178
|
+
<!-- /wp:quote -->"
|
179
|
+
` );
|
236
180
|
|
237
181
|
await page.keyboard.press( 'ArrowLeft' );
|
238
|
-
await page.keyboard.press( '
|
239
|
-
await page.keyboard.press( '
|
240
|
-
await page.keyboard.press( 'ArrowDown' );
|
182
|
+
await page.keyboard.press( 'ArrowUp' );
|
183
|
+
await page.keyboard.press( 'ArrowUp' );
|
241
184
|
await page.keyboard.press( 'Backspace' );
|
242
185
|
|
243
|
-
expect( await getEditedPostContent() ).
|
186
|
+
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
187
|
+
"<!-- wp:paragraph -->
|
188
|
+
<p>1</p>
|
189
|
+
<!-- /wp:paragraph -->
|
190
|
+
|
191
|
+
<!-- wp:paragraph -->
|
192
|
+
<p>2</p>
|
193
|
+
<!-- /wp:paragraph -->"
|
194
|
+
` );
|
244
195
|
} );
|
245
196
|
} );
|