@wordpress/e2e-tests 4.5.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 +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 +11 -50
- 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/iframed-block.test.js +3 -2
- package/specs/editor/plugins/iframed-masonry-block.test.js +3 -2
- 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__/writing-flow.test.js.snap +3 -3
- 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/datepicker.test.js +9 -11
- 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 +2 -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/sidebar.test.js +4 -6
- package/specs/editor/various/typewriter.test.js +2 -2
- package/specs/editor/various/writing-flow.test.js +74 -1
- package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +0 -33
- package/specs/editor/blocks/__snapshots__/list.test.js.snap +0 -337
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +0 -13
- package/specs/editor/blocks/__snapshots__/table.test.js.snap +0 -61
- package/specs/editor/blocks/buttons.test.js +0 -95
- package/specs/editor/blocks/comments.test.js +0 -131
- package/specs/editor/blocks/list.test.js +0 -542
- package/specs/editor/blocks/spacer.test.js +0 -48
- package/specs/editor/blocks/table.test.js +0 -295
- 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/format-api.test.js +0 -36
- package/specs/editor/plugins/hooks-api.test.js +0 -44
- package/specs/editor/various/__snapshots__/rtl.test.js.snap +0 -63
- package/specs/editor/various/block-mover.test.js +0 -42
- package/specs/editor/various/preview.test.js +0 -425
- package/specs/editor/various/rtl.test.js +0 -129
- package/specs/site-editor/style-variations.test.js +0 -213
- package/themes/style-variations/block-templates/index.html +0 -11
- package/themes/style-variations/index.php +0 -0
- package/themes/style-variations/style.css +0 -15
- package/themes/style-variations/styles/pink.json +0 -33
- package/themes/style-variations/styles/yellow.json +0 -12
- package/themes/style-variations/theme.json +0 -8
@@ -1,542 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
clickBlockAppender,
|
6
|
-
clickBlockToolbarButton,
|
7
|
-
getEditedPostContent,
|
8
|
-
createNewPost,
|
9
|
-
pressKeyTimes,
|
10
|
-
transformBlockTo,
|
11
|
-
pressKeyWithModifier,
|
12
|
-
insertBlock,
|
13
|
-
showBlockToolbar,
|
14
|
-
} from '@wordpress/e2e-test-utils';
|
15
|
-
|
16
|
-
describe( 'List', () => {
|
17
|
-
beforeEach( async () => {
|
18
|
-
await createNewPost();
|
19
|
-
} );
|
20
|
-
|
21
|
-
it( 'can be created by using an asterisk at the start of a paragraph block', async () => {
|
22
|
-
// Create a block with some text that will trigger a list creation.
|
23
|
-
await clickBlockAppender();
|
24
|
-
await page.keyboard.type( '* A list item' );
|
25
|
-
|
26
|
-
// Create a second list item.
|
27
|
-
await page.keyboard.press( 'Enter' );
|
28
|
-
await page.keyboard.type( 'Another list item' );
|
29
|
-
|
30
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
31
|
-
} );
|
32
|
-
|
33
|
-
it( 'can be created by typing an asterisk in front of text of a paragraph block', async () => {
|
34
|
-
// Create a list with the slash block shortcut.
|
35
|
-
await clickBlockAppender();
|
36
|
-
await page.keyboard.type( 'test' );
|
37
|
-
await pressKeyTimes( 'ArrowLeft', 4 );
|
38
|
-
await page.keyboard.type( '* ' );
|
39
|
-
|
40
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
41
|
-
} );
|
42
|
-
|
43
|
-
it( 'can be created by using a number at the start of a paragraph block', async () => {
|
44
|
-
// Create a block with some text that will trigger a list creation.
|
45
|
-
await clickBlockAppender();
|
46
|
-
await page.keyboard.type( '1) A list item' );
|
47
|
-
|
48
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
49
|
-
} );
|
50
|
-
|
51
|
-
it( 'can undo asterisk transform', async () => {
|
52
|
-
await clickBlockAppender();
|
53
|
-
await page.keyboard.type( '1. ' );
|
54
|
-
await pressKeyWithModifier( 'primary', 'z' );
|
55
|
-
|
56
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
57
|
-
} );
|
58
|
-
|
59
|
-
it( 'should undo asterisk transform with backspace', async () => {
|
60
|
-
await clickBlockAppender();
|
61
|
-
await page.keyboard.type( '* ' );
|
62
|
-
await page.keyboard.press( 'Backspace' );
|
63
|
-
|
64
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
65
|
-
} );
|
66
|
-
|
67
|
-
it( 'should undo asterisk transform with backspace after selection changes', async () => {
|
68
|
-
await clickBlockAppender();
|
69
|
-
await page.keyboard.type( '* ' );
|
70
|
-
await page.evaluate( () => new Promise( window.requestIdleCallback ) );
|
71
|
-
await page.keyboard.press( 'Backspace' );
|
72
|
-
|
73
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
74
|
-
} );
|
75
|
-
|
76
|
-
it( 'should undo asterisk transform with backspace setting isTyping state', async () => {
|
77
|
-
await clickBlockAppender();
|
78
|
-
await page.keyboard.type( '* ' );
|
79
|
-
await showBlockToolbar();
|
80
|
-
await page.keyboard.press( 'Backspace' );
|
81
|
-
|
82
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
83
|
-
} );
|
84
|
-
|
85
|
-
it( 'should undo asterisk transform with backspace after selection changes without requestIdleCallback', async () => {
|
86
|
-
await clickBlockAppender();
|
87
|
-
await page.evaluate( () => delete window.requestIdleCallback );
|
88
|
-
await page.keyboard.type( '* ' );
|
89
|
-
await new Promise( ( resolve ) => setTimeout( resolve, 100 ) );
|
90
|
-
await page.keyboard.press( 'Backspace' );
|
91
|
-
|
92
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
93
|
-
} );
|
94
|
-
|
95
|
-
it( 'should undo asterisk transform with escape', async () => {
|
96
|
-
await clickBlockAppender();
|
97
|
-
await page.keyboard.type( '* ' );
|
98
|
-
await page.keyboard.press( 'Escape' );
|
99
|
-
|
100
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
101
|
-
} );
|
102
|
-
|
103
|
-
it( 'should not undo asterisk transform with backspace after typing', async () => {
|
104
|
-
await clickBlockAppender();
|
105
|
-
await page.keyboard.type( '* a' );
|
106
|
-
await page.keyboard.press( 'Backspace' );
|
107
|
-
await page.keyboard.press( 'Backspace' );
|
108
|
-
|
109
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
110
|
-
} );
|
111
|
-
|
112
|
-
it( 'should not undo asterisk transform with backspace after selection change', async () => {
|
113
|
-
await clickBlockAppender();
|
114
|
-
await page.keyboard.press( 'Enter' );
|
115
|
-
await page.keyboard.type( '* ' );
|
116
|
-
await page.evaluate( () => new Promise( window.requestIdleCallback ) );
|
117
|
-
await page.keyboard.press( 'ArrowUp' );
|
118
|
-
await page.keyboard.press( 'ArrowDown' );
|
119
|
-
await page.keyboard.press( 'Backspace' );
|
120
|
-
|
121
|
-
// Expect list to be deleted.
|
122
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
123
|
-
} );
|
124
|
-
|
125
|
-
it( 'can be created by typing "/list"', async () => {
|
126
|
-
// Create a list with the slash block shortcut.
|
127
|
-
await clickBlockAppender();
|
128
|
-
await page.keyboard.type( '/list' );
|
129
|
-
await page.waitForXPath(
|
130
|
-
`//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'List')]`
|
131
|
-
);
|
132
|
-
await page.keyboard.press( 'Enter' );
|
133
|
-
await page.keyboard.type( 'I’m a list' );
|
134
|
-
|
135
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
136
|
-
} );
|
137
|
-
|
138
|
-
it( 'can be created by converting a paragraph', async () => {
|
139
|
-
await clickBlockAppender();
|
140
|
-
await page.keyboard.type( 'test' );
|
141
|
-
await transformBlockTo( 'List' );
|
142
|
-
|
143
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
144
|
-
} );
|
145
|
-
|
146
|
-
it( 'can be created by converting multiple paragraphs', async () => {
|
147
|
-
await clickBlockAppender();
|
148
|
-
await page.keyboard.type( 'one' );
|
149
|
-
await page.keyboard.press( 'Enter' );
|
150
|
-
await page.keyboard.type( 'two' );
|
151
|
-
await page.keyboard.down( 'Shift' );
|
152
|
-
await page.click( '[data-type="core/paragraph"]' );
|
153
|
-
await page.keyboard.up( 'Shift' );
|
154
|
-
await transformBlockTo( 'List' );
|
155
|
-
|
156
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
157
|
-
} );
|
158
|
-
|
159
|
-
it( 'can be created by converting a paragraph with line breaks', async () => {
|
160
|
-
await clickBlockAppender();
|
161
|
-
await page.keyboard.type( 'one' );
|
162
|
-
await pressKeyWithModifier( 'shift', 'Enter' );
|
163
|
-
await page.keyboard.type( 'two' );
|
164
|
-
await transformBlockTo( 'List' );
|
165
|
-
|
166
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
167
|
-
} );
|
168
|
-
|
169
|
-
it( 'should not transform lines in block when transforming multiple blocks', async () => {
|
170
|
-
await clickBlockAppender();
|
171
|
-
await page.keyboard.type( 'one' );
|
172
|
-
await pressKeyWithModifier( 'shift', 'Enter' );
|
173
|
-
await page.keyboard.type( '...' );
|
174
|
-
await page.keyboard.press( 'Enter' );
|
175
|
-
await page.keyboard.type( 'two' );
|
176
|
-
await page.keyboard.down( 'Shift' );
|
177
|
-
await page.click( '[data-type="core/paragraph"]' );
|
178
|
-
await page.keyboard.up( 'Shift' );
|
179
|
-
await transformBlockTo( 'List' );
|
180
|
-
|
181
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
182
|
-
} );
|
183
|
-
|
184
|
-
it( 'can be converted to paragraphs', async () => {
|
185
|
-
await insertBlock( 'List' );
|
186
|
-
await page.keyboard.type( 'one' );
|
187
|
-
await page.keyboard.press( 'Enter' );
|
188
|
-
await page.keyboard.type( 'two' );
|
189
|
-
await transformBlockTo( 'Paragraph' );
|
190
|
-
|
191
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
192
|
-
} );
|
193
|
-
|
194
|
-
it( 'can be converted when nested to paragraphs', async () => {
|
195
|
-
await insertBlock( 'List' );
|
196
|
-
await page.keyboard.type( 'one' );
|
197
|
-
await page.keyboard.press( 'Enter' );
|
198
|
-
await clickBlockToolbarButton( 'Indent' );
|
199
|
-
await page.keyboard.type( 'two' );
|
200
|
-
await transformBlockTo( 'Paragraph' );
|
201
|
-
|
202
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
203
|
-
} );
|
204
|
-
|
205
|
-
it( 'can be created by converting a quote', async () => {
|
206
|
-
await insertBlock( 'Quote' );
|
207
|
-
await page.keyboard.type( 'one' );
|
208
|
-
await page.keyboard.press( 'Enter' );
|
209
|
-
await page.keyboard.type( 'two' );
|
210
|
-
await transformBlockTo( 'List' );
|
211
|
-
|
212
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
213
|
-
} );
|
214
|
-
|
215
|
-
it( 'can be converted to a quote', async () => {
|
216
|
-
await insertBlock( 'List' );
|
217
|
-
await page.keyboard.type( 'one' );
|
218
|
-
await page.keyboard.press( 'Enter' );
|
219
|
-
await page.keyboard.type( 'two' );
|
220
|
-
await transformBlockTo( 'Quote' );
|
221
|
-
|
222
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
223
|
-
} );
|
224
|
-
|
225
|
-
it( 'should create paragraph on split at end and merge back with content', async () => {
|
226
|
-
await insertBlock( 'List' );
|
227
|
-
await page.keyboard.type( 'one' );
|
228
|
-
await page.keyboard.press( 'Enter' );
|
229
|
-
await page.keyboard.press( 'Enter' );
|
230
|
-
|
231
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
232
|
-
|
233
|
-
await page.keyboard.type( 'two' );
|
234
|
-
await pressKeyTimes( 'ArrowLeft', 'two'.length );
|
235
|
-
await page.keyboard.press( 'Backspace' );
|
236
|
-
|
237
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
238
|
-
} );
|
239
|
-
|
240
|
-
it( 'should split into two with paragraph and merge lists', async () => {
|
241
|
-
await insertBlock( 'List' );
|
242
|
-
await page.keyboard.type( 'one' );
|
243
|
-
await page.keyboard.press( 'Enter' );
|
244
|
-
await page.keyboard.type( 'two' );
|
245
|
-
await page.keyboard.press( 'ArrowUp' );
|
246
|
-
await page.keyboard.press( 'Enter' );
|
247
|
-
|
248
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
249
|
-
|
250
|
-
await page.keyboard.press( 'Enter' );
|
251
|
-
|
252
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
253
|
-
|
254
|
-
// Should remove paragraph without creating empty list item.
|
255
|
-
await page.keyboard.press( 'Backspace' );
|
256
|
-
|
257
|
-
// Should merge lists into one.
|
258
|
-
await page.keyboard.press( 'ArrowDown' );
|
259
|
-
await pressKeyTimes( 'ArrowLeft', 'two'.length );
|
260
|
-
|
261
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
262
|
-
} );
|
263
|
-
|
264
|
-
it( 'should split into two ordered lists with paragraph', async () => {
|
265
|
-
await clickBlockAppender();
|
266
|
-
await page.keyboard.type( '1. one' );
|
267
|
-
await page.keyboard.press( 'Enter' );
|
268
|
-
await page.keyboard.type( 'two' );
|
269
|
-
await page.keyboard.press( 'ArrowUp' );
|
270
|
-
await page.keyboard.press( 'Enter' );
|
271
|
-
await page.keyboard.press( 'Enter' );
|
272
|
-
|
273
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
274
|
-
} );
|
275
|
-
|
276
|
-
it( 'should split indented list item', async () => {
|
277
|
-
await insertBlock( 'List' );
|
278
|
-
await page.keyboard.type( 'one' );
|
279
|
-
await page.keyboard.press( 'Enter' );
|
280
|
-
await clickBlockToolbarButton( 'Indent' );
|
281
|
-
await page.keyboard.type( 'two' );
|
282
|
-
await page.keyboard.press( 'Enter' );
|
283
|
-
await page.keyboard.type( 'three' );
|
284
|
-
|
285
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
286
|
-
} );
|
287
|
-
|
288
|
-
it( 'should be immeadiately saved on indentation', async () => {
|
289
|
-
await insertBlock( 'List' );
|
290
|
-
await page.keyboard.type( 'one' );
|
291
|
-
await page.keyboard.press( 'Enter' );
|
292
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
293
|
-
|
294
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
295
|
-
} );
|
296
|
-
|
297
|
-
it( 'should change the base list type', async () => {
|
298
|
-
await insertBlock( 'List' );
|
299
|
-
const button = await page.waitForSelector(
|
300
|
-
'button[aria-label="Ordered"]'
|
301
|
-
);
|
302
|
-
await button.click();
|
303
|
-
|
304
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
305
|
-
} );
|
306
|
-
|
307
|
-
it( 'should change the indented list type', async () => {
|
308
|
-
await insertBlock( 'List' );
|
309
|
-
await page.keyboard.type( 'a' );
|
310
|
-
await page.keyboard.press( 'Enter' );
|
311
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
312
|
-
await page.keyboard.type( '1' );
|
313
|
-
|
314
|
-
await clickBlockToolbarButton( 'Ordered' );
|
315
|
-
|
316
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
317
|
-
} );
|
318
|
-
|
319
|
-
it( 'should indent and outdent level 1', async () => {
|
320
|
-
await insertBlock( 'List' );
|
321
|
-
await page.keyboard.type( 'a' );
|
322
|
-
await page.keyboard.press( 'Enter' );
|
323
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
324
|
-
await page.keyboard.type( '1' );
|
325
|
-
|
326
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
327
|
-
|
328
|
-
await pressKeyWithModifier( 'primaryShift', 'm' );
|
329
|
-
|
330
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
331
|
-
} );
|
332
|
-
|
333
|
-
it( 'should indent and outdent level 2', async () => {
|
334
|
-
await insertBlock( 'List' );
|
335
|
-
await page.keyboard.type( 'a' );
|
336
|
-
await page.keyboard.press( 'Enter' );
|
337
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
338
|
-
await page.keyboard.type( '1' );
|
339
|
-
await page.keyboard.press( 'Enter' );
|
340
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
341
|
-
await page.keyboard.type( 'i' );
|
342
|
-
|
343
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
344
|
-
|
345
|
-
await pressKeyWithModifier( 'primaryShift', 'm' );
|
346
|
-
|
347
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
348
|
-
|
349
|
-
await pressKeyWithModifier( 'primaryShift', 'm' );
|
350
|
-
|
351
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
352
|
-
} );
|
353
|
-
|
354
|
-
it( 'should outdent with children', async () => {
|
355
|
-
await insertBlock( 'List' );
|
356
|
-
await page.keyboard.type( 'a' );
|
357
|
-
await page.keyboard.press( 'Enter' );
|
358
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
359
|
-
await page.keyboard.type( 'b' );
|
360
|
-
await page.keyboard.press( 'Enter' );
|
361
|
-
await pressKeyWithModifier( 'primary', 'm' );
|
362
|
-
await page.keyboard.type( 'c' );
|
363
|
-
|
364
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
365
|
-
|
366
|
-
await page.keyboard.press( 'ArrowUp' );
|
367
|
-
await pressKeyWithModifier( 'primaryShift', 'm' );
|
368
|
-
|
369
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
370
|
-
} );
|
371
|
-
|
372
|
-
it( 'should insert a line break on shift+enter', async () => {
|
373
|
-
await insertBlock( 'List' );
|
374
|
-
await page.keyboard.type( 'a' );
|
375
|
-
await pressKeyWithModifier( 'shift', 'Enter' );
|
376
|
-
|
377
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
378
|
-
} );
|
379
|
-
|
380
|
-
it( 'should insert a line break on shift+enter in a non trailing list item', async () => {
|
381
|
-
await insertBlock( 'List' );
|
382
|
-
await page.keyboard.type( 'a' );
|
383
|
-
await page.keyboard.press( 'Enter' );
|
384
|
-
await page.keyboard.type( 'b' );
|
385
|
-
await page.keyboard.press( 'Enter' );
|
386
|
-
await page.keyboard.type( 'c' );
|
387
|
-
await page.keyboard.press( 'ArrowUp' );
|
388
|
-
await pressKeyWithModifier( 'shift', 'Enter' );
|
389
|
-
|
390
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
391
|
-
} );
|
392
|
-
|
393
|
-
it( 'should create and remove indented list with keyboard only', async () => {
|
394
|
-
await clickBlockAppender();
|
395
|
-
|
396
|
-
await page.keyboard.type( '* 1' ); // Should be at level 0.
|
397
|
-
await page.keyboard.press( 'Enter' );
|
398
|
-
await page.keyboard.type( ' a' ); // Should be at level 1.
|
399
|
-
await page.keyboard.press( 'Enter' );
|
400
|
-
await page.keyboard.type( ' i' ); // Should be at level 2.
|
401
|
-
|
402
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
403
|
-
|
404
|
-
await page.keyboard.press( 'Backspace' );
|
405
|
-
await page.keyboard.press( 'Backspace' ); // Should be at level 1.
|
406
|
-
|
407
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
408
|
-
|
409
|
-
await page.keyboard.press( 'Backspace' ); // Should be at level 0.
|
410
|
-
|
411
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
412
|
-
|
413
|
-
await page.keyboard.press( 'Backspace' ); // Should be at level 1.
|
414
|
-
|
415
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
416
|
-
|
417
|
-
await page.keyboard.press( 'Backspace' );
|
418
|
-
await page.keyboard.press( 'Backspace' ); // Should be at level 0.
|
419
|
-
|
420
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
421
|
-
|
422
|
-
await page.keyboard.press( 'Backspace' ); // Should be at level 0.
|
423
|
-
|
424
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
425
|
-
|
426
|
-
await page.keyboard.press( 'Backspace' );
|
427
|
-
await page.keyboard.press( 'Backspace' ); // Should remove list.
|
428
|
-
|
429
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
430
|
-
|
431
|
-
// That's 9 key presses to create the list, and 9 key presses to remove
|
432
|
-
// the list. ;)
|
433
|
-
} );
|
434
|
-
|
435
|
-
it( 'should place the caret in the right place with nested list', async () => {
|
436
|
-
await clickBlockAppender();
|
437
|
-
await page.keyboard.type( '* 1' );
|
438
|
-
await page.keyboard.press( 'Enter' );
|
439
|
-
await page.keyboard.type( ' a' );
|
440
|
-
await page.keyboard.press( 'ArrowUp' );
|
441
|
-
await page.keyboard.press( 'Enter' );
|
442
|
-
// The caret should land in the second item.
|
443
|
-
await page.keyboard.type( '2' );
|
444
|
-
|
445
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
446
|
-
} );
|
447
|
-
|
448
|
-
it( 'should not indent list on space with modifier', async () => {
|
449
|
-
await clickBlockAppender();
|
450
|
-
|
451
|
-
await page.keyboard.type( '* 1' );
|
452
|
-
await page.keyboard.press( 'Enter' );
|
453
|
-
await pressKeyWithModifier( 'shift', 'Space' );
|
454
|
-
|
455
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
456
|
-
} );
|
457
|
-
|
458
|
-
it( 'should only convert to list when shortcut ends with space', async () => {
|
459
|
-
await clickBlockAppender();
|
460
|
-
|
461
|
-
// Tests the shortcut with a non breaking space.
|
462
|
-
await page.keyboard.type( '* ' );
|
463
|
-
|
464
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
465
|
-
} );
|
466
|
-
|
467
|
-
it( 'should preserve indentation after merging backward and forward', async () => {
|
468
|
-
await clickBlockAppender();
|
469
|
-
|
470
|
-
// Tests the shortcut with a non breaking space.
|
471
|
-
await page.keyboard.type( '* 1' );
|
472
|
-
await page.keyboard.press( 'Enter' );
|
473
|
-
await page.keyboard.press( 'Space' );
|
474
|
-
await page.keyboard.type( '2' );
|
475
|
-
await page.keyboard.press( 'Enter' );
|
476
|
-
await page.keyboard.type( '3' );
|
477
|
-
|
478
|
-
// Create a new paragraph.
|
479
|
-
await page.keyboard.press( 'Enter' );
|
480
|
-
await page.keyboard.press( 'Enter' );
|
481
|
-
|
482
|
-
// Merge the pragraph back. No list items should be joined.
|
483
|
-
await page.keyboard.press( 'Backspace' );
|
484
|
-
|
485
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
486
|
-
|
487
|
-
// Again create a new paragraph.
|
488
|
-
await page.keyboard.press( 'Enter' );
|
489
|
-
|
490
|
-
// Move to the end of the list.
|
491
|
-
await page.keyboard.press( 'ArrowLeft' );
|
492
|
-
|
493
|
-
// Merge forward. No list items should be joined.
|
494
|
-
await page.keyboard.press( 'Delete' );
|
495
|
-
|
496
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
497
|
-
} );
|
498
|
-
|
499
|
-
it( 'first empty list item is graciously removed', async () => {
|
500
|
-
await clickBlockAppender();
|
501
|
-
await page.keyboard.type( '* 1' );
|
502
|
-
await page.keyboard.press( 'Enter' );
|
503
|
-
await page.keyboard.type( '2' );
|
504
|
-
await page.keyboard.press( 'ArrowUp' );
|
505
|
-
await page.keyboard.press( 'Backspace' );
|
506
|
-
await page.keyboard.press( 'Backspace' );
|
507
|
-
|
508
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
509
|
-
} );
|
510
|
-
|
511
|
-
it( 'should not change the contents when you change the list type to Ordered', async () => {
|
512
|
-
await clickBlockAppender();
|
513
|
-
await page.keyboard.type( '* 1' );
|
514
|
-
await page.keyboard.press( 'Enter' );
|
515
|
-
await page.keyboard.type( '2' );
|
516
|
-
await page.keyboard.press( 'Enter' );
|
517
|
-
await page.keyboard.type( '3' );
|
518
|
-
await clickBlockToolbarButton( 'Ordered' );
|
519
|
-
|
520
|
-
const content = await page.$eval(
|
521
|
-
'.wp-block-list',
|
522
|
-
( el ) => el.innerHTML
|
523
|
-
);
|
524
|
-
expect( content ).toMatchSnapshot();
|
525
|
-
} );
|
526
|
-
|
527
|
-
it( 'should not change the contents when you change the list type to Unordered', async () => {
|
528
|
-
await clickBlockAppender();
|
529
|
-
await page.keyboard.type( '1. a' );
|
530
|
-
await page.keyboard.press( 'Enter' );
|
531
|
-
await page.keyboard.type( 'b' );
|
532
|
-
await page.keyboard.press( 'Enter' );
|
533
|
-
await page.keyboard.type( 'c' );
|
534
|
-
await clickBlockToolbarButton( 'Unordered' );
|
535
|
-
|
536
|
-
const content = await page.$eval(
|
537
|
-
'.wp-block-list',
|
538
|
-
( el ) => el.innerHTML
|
539
|
-
);
|
540
|
-
expect( content ).toMatchSnapshot();
|
541
|
-
} );
|
542
|
-
} );
|
@@ -1,48 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
clickBlockAppender,
|
6
|
-
getEditedPostContent,
|
7
|
-
createNewPost,
|
8
|
-
dragAndResize,
|
9
|
-
} from '@wordpress/e2e-test-utils';
|
10
|
-
|
11
|
-
describe( 'Spacer', () => {
|
12
|
-
beforeEach( async () => {
|
13
|
-
await createNewPost();
|
14
|
-
} );
|
15
|
-
|
16
|
-
it( 'can be created by typing "/spacer"', async () => {
|
17
|
-
// Create a spacer with the slash block shortcut.
|
18
|
-
await clickBlockAppender();
|
19
|
-
await page.keyboard.type( '/spacer' );
|
20
|
-
await page.waitForXPath(
|
21
|
-
`//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Spacer')]`
|
22
|
-
);
|
23
|
-
await page.keyboard.press( 'Enter' );
|
24
|
-
|
25
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
26
|
-
} );
|
27
|
-
|
28
|
-
it( 'can be resized using the drag handle and remains selected after being dragged', async () => {
|
29
|
-
// Create a spacer with the slash block shortcut.
|
30
|
-
await clickBlockAppender();
|
31
|
-
await page.keyboard.type( '/spacer' );
|
32
|
-
await page.waitForXPath(
|
33
|
-
`//*[contains(@class, "components-autocomplete__result") and contains(@class, "is-selected") and contains(text(), 'Spacer')]`
|
34
|
-
);
|
35
|
-
await page.keyboard.press( 'Enter' );
|
36
|
-
|
37
|
-
const resizableHandle = await page.$(
|
38
|
-
'.block-library-spacer__resize-container .components-resizable-box__handle'
|
39
|
-
);
|
40
|
-
await dragAndResize( resizableHandle, { x: 0, y: 50 } );
|
41
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
42
|
-
|
43
|
-
const selectedSpacer = await page.$(
|
44
|
-
'[data-type="core/spacer"].is-selected'
|
45
|
-
);
|
46
|
-
expect( selectedSpacer ).not.toBe( null );
|
47
|
-
} );
|
48
|
-
} );
|