@wordpress/e2e-tests 5.0.0 → 5.1.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/assets/large-post.html +1478 -96
- package/package.json +5 -5
- package/specs/editor/blocks/navigation.test.js +4 -6
- package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +3 -1
- package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
- package/specs/editor/plugins/cpt-locking.test.js +15 -15
- package/specs/editor/plugins/iframed-block.test.js +2 -12
- package/specs/editor/plugins/iframed-inline-styles.test.js +3 -12
- package/specs/editor/plugins/iframed-masonry-block.test.js +2 -12
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +3 -12
- package/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +3 -0
- package/specs/editor/various/__snapshots__/block-deletion.test.js.snap +3 -1
- package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +0 -6
- package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +25 -1
- package/specs/editor/various/__snapshots__/rich-text.test.js.snap +19 -5
- package/specs/editor/various/block-switcher.test.js +11 -3
- package/specs/editor/various/font-size-picker.test.js +1 -3
- package/specs/editor/various/inserting-blocks.test.js +4 -0
- package/specs/editor/various/keep-styles-on-block-transforms.test.js +0 -17
- package/specs/editor/various/multi-block-selection.test.js +8 -0
- package/specs/editor/various/rich-text.test.js +9 -6
- package/specs/editor/various/splitting-merging.test.js +7 -2
- package/specs/editor/various/toolbar-roving-tabindex.test.js +2 -1
- package/specs/editor/plugins/register-block-type-hooks.test.js +0 -32
- package/specs/editor/various/__snapshots__/draggable-block.test.js.snap +0 -41
- package/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap +0 -21
- package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +0 -305
- package/specs/editor/various/draggable-block.test.js +0 -127
- package/specs/editor/various/duplicating-blocks.test.js +0 -47
- package/specs/editor/various/writing-flow.test.js +0 -829
@@ -1,41 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Draggable block can drag and drop to the bottom of a block list 1`] = `
|
4
|
-
"<!-- wp:paragraph -->
|
5
|
-
<p>1</p>
|
6
|
-
<!-- /wp:paragraph -->
|
7
|
-
|
8
|
-
<!-- wp:paragraph -->
|
9
|
-
<p>2</p>
|
10
|
-
<!-- /wp:paragraph -->"
|
11
|
-
`;
|
12
|
-
|
13
|
-
exports[`Draggable block can drag and drop to the bottom of a block list 2`] = `
|
14
|
-
"<!-- wp:paragraph -->
|
15
|
-
<p>2</p>
|
16
|
-
<!-- /wp:paragraph -->
|
17
|
-
|
18
|
-
<!-- wp:paragraph -->
|
19
|
-
<p>1</p>
|
20
|
-
<!-- /wp:paragraph -->"
|
21
|
-
`;
|
22
|
-
|
23
|
-
exports[`Draggable block can drag and drop to the top of a block list 1`] = `
|
24
|
-
"<!-- wp:paragraph -->
|
25
|
-
<p>1</p>
|
26
|
-
<!-- /wp:paragraph -->
|
27
|
-
|
28
|
-
<!-- wp:paragraph -->
|
29
|
-
<p>2</p>
|
30
|
-
<!-- /wp:paragraph -->"
|
31
|
-
`;
|
32
|
-
|
33
|
-
exports[`Draggable block can drag and drop to the top of a block list 2`] = `
|
34
|
-
"<!-- wp:paragraph -->
|
35
|
-
<p>2</p>
|
36
|
-
<!-- /wp:paragraph -->
|
37
|
-
|
38
|
-
<!-- wp:paragraph -->
|
39
|
-
<p>1</p>
|
40
|
-
<!-- /wp:paragraph -->"
|
41
|
-
`;
|
@@ -1,21 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Duplicating blocks should duplicate blocks using the block settings menu 1`] = `
|
4
|
-
"<!-- wp:paragraph -->
|
5
|
-
<p>Clone me</p>
|
6
|
-
<!-- /wp:paragraph -->
|
7
|
-
|
8
|
-
<!-- wp:paragraph -->
|
9
|
-
<p>Clone me</p>
|
10
|
-
<!-- /wp:paragraph -->"
|
11
|
-
`;
|
12
|
-
|
13
|
-
exports[`Duplicating blocks should duplicate blocks using the keyboard shortcut 1`] = `
|
14
|
-
"<!-- wp:paragraph -->
|
15
|
-
<p>Clone me</p>
|
16
|
-
<!-- /wp:paragraph -->
|
17
|
-
|
18
|
-
<!-- wp:paragraph -->
|
19
|
-
<p>Clone me</p>
|
20
|
-
<!-- /wp:paragraph -->"
|
21
|
-
`;
|
@@ -1,305 +0,0 @@
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
2
|
-
|
3
|
-
exports[`Writing Flow Should navigate inner blocks with arrow keys 1`] = `
|
4
|
-
"<!-- wp:paragraph -->
|
5
|
-
<p>First paragraph</p>
|
6
|
-
<!-- /wp:paragraph -->
|
7
|
-
|
8
|
-
<!-- wp:columns -->
|
9
|
-
<div class=\\"wp-block-columns\\"><!-- wp:column -->
|
10
|
-
<div class=\\"wp-block-column\\"><!-- wp:paragraph -->
|
11
|
-
<p>1st col</p>
|
12
|
-
<!-- /wp:paragraph --></div>
|
13
|
-
<!-- /wp:column -->
|
14
|
-
|
15
|
-
<!-- wp:column -->
|
16
|
-
<div class=\\"wp-block-column\\"><!-- wp:paragraph -->
|
17
|
-
<p>2nd col</p>
|
18
|
-
<!-- /wp:paragraph --></div>
|
19
|
-
<!-- /wp:column --></div>
|
20
|
-
<!-- /wp:columns -->
|
21
|
-
|
22
|
-
<!-- wp:paragraph -->
|
23
|
-
<p>Second paragraph</p>
|
24
|
-
<!-- /wp:paragraph -->"
|
25
|
-
`;
|
26
|
-
|
27
|
-
exports[`Writing Flow should allow selecting entire list with longer last item 1`] = `
|
28
|
-
"<!-- wp:paragraph -->
|
29
|
-
<p>a</p>
|
30
|
-
<!-- /wp:paragraph -->
|
31
|
-
|
32
|
-
<!-- wp:list -->
|
33
|
-
<ul><li></li></ul>
|
34
|
-
<!-- /wp:list -->"
|
35
|
-
`;
|
36
|
-
|
37
|
-
exports[`Writing Flow should create valid paragraph blocks when rapidly pressing Enter 1`] = `
|
38
|
-
"<!-- wp:paragraph -->
|
39
|
-
<p></p>
|
40
|
-
<!-- /wp:paragraph -->
|
41
|
-
|
42
|
-
<!-- wp:paragraph -->
|
43
|
-
<p></p>
|
44
|
-
<!-- /wp:paragraph -->
|
45
|
-
|
46
|
-
<!-- wp:paragraph -->
|
47
|
-
<p></p>
|
48
|
-
<!-- /wp:paragraph -->
|
49
|
-
|
50
|
-
<!-- wp:paragraph -->
|
51
|
-
<p></p>
|
52
|
-
<!-- /wp:paragraph -->
|
53
|
-
|
54
|
-
<!-- wp:paragraph -->
|
55
|
-
<p></p>
|
56
|
-
<!-- /wp:paragraph -->
|
57
|
-
|
58
|
-
<!-- wp:paragraph -->
|
59
|
-
<p></p>
|
60
|
-
<!-- /wp:paragraph -->
|
61
|
-
|
62
|
-
<!-- wp:paragraph -->
|
63
|
-
<p></p>
|
64
|
-
<!-- /wp:paragraph -->
|
65
|
-
|
66
|
-
<!-- wp:paragraph -->
|
67
|
-
<p></p>
|
68
|
-
<!-- /wp:paragraph -->
|
69
|
-
|
70
|
-
<!-- wp:paragraph -->
|
71
|
-
<p></p>
|
72
|
-
<!-- /wp:paragraph -->
|
73
|
-
|
74
|
-
<!-- wp:paragraph -->
|
75
|
-
<p></p>
|
76
|
-
<!-- /wp:paragraph -->
|
77
|
-
|
78
|
-
<!-- wp:paragraph -->
|
79
|
-
<p></p>
|
80
|
-
<!-- /wp:paragraph -->"
|
81
|
-
`;
|
82
|
-
|
83
|
-
exports[`Writing Flow should insert line break at end 1`] = `
|
84
|
-
"<!-- wp:paragraph -->
|
85
|
-
<p>a<br></p>
|
86
|
-
<!-- /wp:paragraph -->"
|
87
|
-
`;
|
88
|
-
|
89
|
-
exports[`Writing Flow should insert line break at end and continue writing 1`] = `
|
90
|
-
"<!-- wp:paragraph -->
|
91
|
-
<p>a<br>b</p>
|
92
|
-
<!-- /wp:paragraph -->"
|
93
|
-
`;
|
94
|
-
|
95
|
-
exports[`Writing Flow should insert line break at start 1`] = `
|
96
|
-
"<!-- wp:paragraph -->
|
97
|
-
<p><br>a</p>
|
98
|
-
<!-- /wp:paragraph -->"
|
99
|
-
`;
|
100
|
-
|
101
|
-
exports[`Writing Flow should insert line break in empty container 1`] = `
|
102
|
-
"<!-- wp:paragraph -->
|
103
|
-
<p><br></p>
|
104
|
-
<!-- /wp:paragraph -->"
|
105
|
-
`;
|
106
|
-
|
107
|
-
exports[`Writing Flow should insert line break mid text 1`] = `
|
108
|
-
"<!-- wp:paragraph -->
|
109
|
-
<p>a<br>b</p>
|
110
|
-
<!-- /wp:paragraph -->"
|
111
|
-
`;
|
112
|
-
|
113
|
-
exports[`Writing Flow should merge forwards 1`] = `
|
114
|
-
"<!-- wp:paragraph -->
|
115
|
-
<p>123</p>
|
116
|
-
<!-- /wp:paragraph -->"
|
117
|
-
`;
|
118
|
-
|
119
|
-
exports[`Writing Flow should merge paragraphs 1`] = `
|
120
|
-
"<!-- wp:paragraph -->
|
121
|
-
<p>12</p>
|
122
|
-
<!-- /wp:paragraph -->"
|
123
|
-
`;
|
124
|
-
|
125
|
-
exports[`Writing Flow should navigate around inline boundaries 1`] = `
|
126
|
-
"<!-- wp:paragraph -->
|
127
|
-
<p>FirstAfter</p>
|
128
|
-
<!-- /wp:paragraph -->
|
129
|
-
|
130
|
-
<!-- wp:paragraph -->
|
131
|
-
<p>Before<strong>InsideSecondInside</strong>After</p>
|
132
|
-
<!-- /wp:paragraph -->
|
133
|
-
|
134
|
-
<!-- wp:paragraph -->
|
135
|
-
<p>BeforeThird</p>
|
136
|
-
<!-- /wp:paragraph -->"
|
137
|
-
`;
|
138
|
-
|
139
|
-
exports[`Writing Flow should navigate around nested inline boundaries 1`] = `
|
140
|
-
"<!-- wp:paragraph -->
|
141
|
-
<p><strong><em>1</em> <em>2</em></strong></p>
|
142
|
-
<!-- /wp:paragraph -->"
|
143
|
-
`;
|
144
|
-
|
145
|
-
exports[`Writing Flow should navigate around nested inline boundaries 2`] = `
|
146
|
-
"<!-- wp:paragraph -->
|
147
|
-
<p>a<strong>b<em>c1d</em>e f<em>g2h</em>i</strong>j</p>
|
148
|
-
<!-- /wp:paragraph -->"
|
149
|
-
`;
|
150
|
-
|
151
|
-
exports[`Writing Flow should navigate contenteditable with normal line height 1`] = `
|
152
|
-
"<!-- wp:paragraph -->
|
153
|
-
<p>1</p>
|
154
|
-
<!-- /wp:paragraph -->
|
155
|
-
|
156
|
-
<!-- wp:paragraph -->
|
157
|
-
<p></p>
|
158
|
-
<!-- /wp:paragraph -->"
|
159
|
-
`;
|
160
|
-
|
161
|
-
exports[`Writing Flow should navigate contenteditable with padding 1`] = `
|
162
|
-
"<!-- wp:paragraph -->
|
163
|
-
<p>1</p>
|
164
|
-
<!-- /wp:paragraph -->
|
165
|
-
|
166
|
-
<!-- wp:paragraph -->
|
167
|
-
<p>2</p>
|
168
|
-
<!-- /wp:paragraph -->"
|
169
|
-
`;
|
170
|
-
|
171
|
-
exports[`Writing Flow should navigate contenteditable with side padding 1`] = `
|
172
|
-
"<!-- wp:paragraph -->
|
173
|
-
<p>1</p>
|
174
|
-
<!-- /wp:paragraph -->
|
175
|
-
|
176
|
-
<!-- wp:paragraph -->
|
177
|
-
<p></p>
|
178
|
-
<!-- /wp:paragraph -->
|
179
|
-
|
180
|
-
<!-- wp:paragraph -->
|
181
|
-
<p></p>
|
182
|
-
<!-- /wp:paragraph -->"
|
183
|
-
`;
|
184
|
-
|
185
|
-
exports[`Writing Flow should navigate empty paragraph 1`] = `
|
186
|
-
"<!-- wp:paragraph -->
|
187
|
-
<p>1</p>
|
188
|
-
<!-- /wp:paragraph -->
|
189
|
-
|
190
|
-
<!-- wp:paragraph -->
|
191
|
-
<p>2</p>
|
192
|
-
<!-- /wp:paragraph -->"
|
193
|
-
`;
|
194
|
-
|
195
|
-
exports[`Writing Flow should navigate empty paragraphs 1`] = `
|
196
|
-
"<!-- wp:paragraph -->
|
197
|
-
<p>1</p>
|
198
|
-
<!-- /wp:paragraph -->
|
199
|
-
|
200
|
-
<!-- wp:paragraph -->
|
201
|
-
<p></p>
|
202
|
-
<!-- /wp:paragraph -->
|
203
|
-
|
204
|
-
<!-- wp:paragraph -->
|
205
|
-
<p>3</p>
|
206
|
-
<!-- /wp:paragraph -->"
|
207
|
-
`;
|
208
|
-
|
209
|
-
exports[`Writing Flow should not create extra line breaks in multiline value 1`] = `
|
210
|
-
"<!-- wp:list -->
|
211
|
-
<ul><li></li></ul>
|
212
|
-
<!-- /wp:list -->"
|
213
|
-
`;
|
214
|
-
|
215
|
-
exports[`Writing Flow should not delete surrounding space when deleting a selected word 1`] = `
|
216
|
-
"<!-- wp:paragraph -->
|
217
|
-
<p>alpha gamma</p>
|
218
|
-
<!-- /wp:paragraph -->"
|
219
|
-
`;
|
220
|
-
|
221
|
-
exports[`Writing Flow should not delete surrounding space when deleting a selected word 2`] = `
|
222
|
-
"<!-- wp:paragraph -->
|
223
|
-
<p>alpha beta gamma</p>
|
224
|
-
<!-- /wp:paragraph -->"
|
225
|
-
`;
|
226
|
-
|
227
|
-
exports[`Writing Flow should not delete surrounding space when deleting a word with Alt+Backspace 1`] = `
|
228
|
-
"<!-- wp:paragraph -->
|
229
|
-
<p>alpha gamma</p>
|
230
|
-
<!-- /wp:paragraph -->"
|
231
|
-
`;
|
232
|
-
|
233
|
-
exports[`Writing Flow should not delete surrounding space when deleting a word with Alt+Backspace 2`] = `
|
234
|
-
"<!-- wp:paragraph -->
|
235
|
-
<p>alpha beta gamma</p>
|
236
|
-
<!-- /wp:paragraph -->"
|
237
|
-
`;
|
238
|
-
|
239
|
-
exports[`Writing Flow should not delete surrounding space when deleting a word with Backspace 1`] = `
|
240
|
-
"<!-- wp:paragraph -->
|
241
|
-
<p>1 3</p>
|
242
|
-
<!-- /wp:paragraph -->"
|
243
|
-
`;
|
244
|
-
|
245
|
-
exports[`Writing Flow should not delete surrounding space when deleting a word with Backspace 2`] = `
|
246
|
-
"<!-- wp:paragraph -->
|
247
|
-
<p>1 2 3</p>
|
248
|
-
<!-- /wp:paragraph -->"
|
249
|
-
`;
|
250
|
-
|
251
|
-
exports[`Writing Flow should not have a dead zone above an aligned block 1`] = `
|
252
|
-
"<!-- wp:paragraph -->
|
253
|
-
<p>1</p>
|
254
|
-
<!-- /wp:paragraph -->
|
255
|
-
|
256
|
-
<!-- wp:image {\\"align\\":\\"wide\\"} -->
|
257
|
-
<figure class=\\"wp-block-image alignwide\\"><img alt=\\"\\"/></figure>
|
258
|
-
<!-- /wp:image -->"
|
259
|
-
`;
|
260
|
-
|
261
|
-
exports[`Writing Flow should not have a dead zone between blocks (lower) 1`] = `
|
262
|
-
"<!-- wp:paragraph -->
|
263
|
-
<p>1</p>
|
264
|
-
<!-- /wp:paragraph -->
|
265
|
-
|
266
|
-
<!-- wp:paragraph -->
|
267
|
-
<p>23</p>
|
268
|
-
<!-- /wp:paragraph -->"
|
269
|
-
`;
|
270
|
-
|
271
|
-
exports[`Writing Flow should not prematurely multi-select 1`] = `
|
272
|
-
"<!-- wp:paragraph -->
|
273
|
-
<p>1</p>
|
274
|
-
<!-- /wp:paragraph -->
|
275
|
-
|
276
|
-
<!-- wp:paragraph -->
|
277
|
-
<p>></p>
|
278
|
-
<!-- /wp:paragraph -->"
|
279
|
-
`;
|
280
|
-
|
281
|
-
exports[`Writing Flow should only consider the content as one tab stop 1`] = `
|
282
|
-
"<!-- wp:table -->
|
283
|
-
<figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td>2</td></tr><tr><td></td><td></td></tr></tbody></table></figure>
|
284
|
-
<!-- /wp:table -->"
|
285
|
-
`;
|
286
|
-
|
287
|
-
exports[`Writing Flow should preserve horizontal position when navigating vertically between blocks 1`] = `
|
288
|
-
"<!-- wp:paragraph -->
|
289
|
-
<p>abc</p>
|
290
|
-
<!-- /wp:paragraph -->
|
291
|
-
|
292
|
-
<!-- wp:paragraph -->
|
293
|
-
<p>123</p>
|
294
|
-
<!-- /wp:paragraph -->"
|
295
|
-
`;
|
296
|
-
|
297
|
-
exports[`Writing Flow should remember initial vertical position 1`] = `
|
298
|
-
"<!-- wp:paragraph -->
|
299
|
-
<p>1x</p>
|
300
|
-
<!-- /wp:paragraph -->
|
301
|
-
|
302
|
-
<!-- wp:paragraph -->
|
303
|
-
<p><br>2</p>
|
304
|
-
<!-- /wp:paragraph -->"
|
305
|
-
`;
|
@@ -1,127 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
getEditedPostContent,
|
6
|
-
createNewPost,
|
7
|
-
deactivatePlugin,
|
8
|
-
activatePlugin,
|
9
|
-
showBlockToolbar,
|
10
|
-
setBrowserViewport,
|
11
|
-
waitForWindowDimensions,
|
12
|
-
} from '@wordpress/e2e-test-utils';
|
13
|
-
|
14
|
-
describe( 'Draggable block', () => {
|
15
|
-
// Tests don't seem to pass if beforeAll and afterAll are used.
|
16
|
-
// Unsure why.
|
17
|
-
beforeEach( async () => {
|
18
|
-
await deactivatePlugin(
|
19
|
-
'gutenberg-test-plugin-disables-the-css-animations'
|
20
|
-
);
|
21
|
-
|
22
|
-
// Set the viewport at a larger size than normal to ensure scrolling doesn't occur.
|
23
|
-
// Scrolling can interfere with the drag coordinates.
|
24
|
-
await page.setViewport( { width: 960, height: 1024 } );
|
25
|
-
await waitForWindowDimensions( 960, 1024 );
|
26
|
-
await createNewPost();
|
27
|
-
await page.setDragInterception( true );
|
28
|
-
} );
|
29
|
-
|
30
|
-
afterEach( async () => {
|
31
|
-
await page.setDragInterception( false );
|
32
|
-
|
33
|
-
// Reset the viewport to normal large size.
|
34
|
-
await setBrowserViewport( 'large' );
|
35
|
-
await activatePlugin(
|
36
|
-
'gutenberg-test-plugin-disables-the-css-animations'
|
37
|
-
);
|
38
|
-
} );
|
39
|
-
|
40
|
-
it( 'can drag and drop to the top of a block list', async () => {
|
41
|
-
await page.keyboard.press( 'Enter' );
|
42
|
-
await page.keyboard.type( '1' );
|
43
|
-
await page.keyboard.press( 'Enter' );
|
44
|
-
await page.keyboard.type( '2' );
|
45
|
-
|
46
|
-
// Confirm correct setup.
|
47
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
48
|
-
|
49
|
-
await showBlockToolbar();
|
50
|
-
const dragHandle = await page.waitForSelector(
|
51
|
-
'.block-editor-block-mover__drag-handle'
|
52
|
-
);
|
53
|
-
const dragHandlePoint = await dragHandle.clickablePoint();
|
54
|
-
|
55
|
-
const firstParagraph = await page.$( '[data-type="core/paragraph"]' );
|
56
|
-
const targetPoint = await firstParagraph.clickablePoint();
|
57
|
-
const targetRect = await firstParagraph.boundingBox();
|
58
|
-
const target = {
|
59
|
-
x: targetPoint.x,
|
60
|
-
// Drag to the top half.
|
61
|
-
y: targetPoint.y - targetRect.height * 0.25,
|
62
|
-
};
|
63
|
-
|
64
|
-
const dragData = await page.mouse.drag( dragHandlePoint, target );
|
65
|
-
await page.mouse.dragEnter( target, dragData );
|
66
|
-
await page.mouse.dragOver( target, dragData );
|
67
|
-
|
68
|
-
// Wait for the insertion point to be visible.
|
69
|
-
const insertionPoint = await page.waitForSelector(
|
70
|
-
'.block-editor-block-list__insertion-point'
|
71
|
-
);
|
72
|
-
|
73
|
-
// Expect the insertion point to be visible above the first paragraph.
|
74
|
-
const insertionPointBoundingBox = await insertionPoint.boundingBox();
|
75
|
-
expect( insertionPointBoundingBox.y ).toBeLessThan( target.y );
|
76
|
-
|
77
|
-
await page.mouse.drop( target, dragData );
|
78
|
-
|
79
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
80
|
-
} );
|
81
|
-
|
82
|
-
it( 'can drag and drop to the bottom of a block list', async () => {
|
83
|
-
await page.keyboard.press( 'Enter' );
|
84
|
-
await page.keyboard.type( '1' );
|
85
|
-
await page.keyboard.press( 'Enter' );
|
86
|
-
await page.keyboard.type( '2' );
|
87
|
-
await page.keyboard.press( 'ArrowUp' );
|
88
|
-
|
89
|
-
// Confirm correct setup.
|
90
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
91
|
-
|
92
|
-
const [ , secondParagraph ] = await page.$$(
|
93
|
-
'[data-type="core/paragraph"]'
|
94
|
-
);
|
95
|
-
|
96
|
-
await showBlockToolbar();
|
97
|
-
const dragHandle = await page.waitForSelector(
|
98
|
-
'.block-editor-block-mover__drag-handle'
|
99
|
-
);
|
100
|
-
const dragHandlePoint = await dragHandle.clickablePoint();
|
101
|
-
|
102
|
-
const targetPoint = await secondParagraph.clickablePoint();
|
103
|
-
const targetRect = await secondParagraph.boundingBox();
|
104
|
-
const target = {
|
105
|
-
x: targetPoint.x,
|
106
|
-
// Drag to the bottom half.
|
107
|
-
y: targetPoint.y + targetRect.height * 0.25,
|
108
|
-
};
|
109
|
-
|
110
|
-
const dragData = await page.mouse.drag( dragHandlePoint, target );
|
111
|
-
await page.mouse.dragEnter( target, dragData );
|
112
|
-
await page.mouse.dragOver( target, dragData );
|
113
|
-
|
114
|
-
// Wait for the insertion point to be visible.
|
115
|
-
const insertionPoint = await page.waitForSelector(
|
116
|
-
'.block-editor-block-list__insertion-point'
|
117
|
-
);
|
118
|
-
|
119
|
-
// Expect the insertion point to be visible below the first paragraph.
|
120
|
-
const insertionPointBoundingBox = await insertionPoint.boundingBox();
|
121
|
-
expect( insertionPointBoundingBox.y ).toBeGreaterThan( target.y );
|
122
|
-
|
123
|
-
await page.mouse.drop( target, dragData );
|
124
|
-
|
125
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
126
|
-
} );
|
127
|
-
} );
|
@@ -1,47 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* WordPress dependencies
|
3
|
-
*/
|
4
|
-
import {
|
5
|
-
clickMenuItem,
|
6
|
-
createNewPost,
|
7
|
-
insertBlock,
|
8
|
-
getEditedPostContent,
|
9
|
-
clickBlockToolbarButton,
|
10
|
-
pressKeyWithModifier,
|
11
|
-
} from '@wordpress/e2e-test-utils';
|
12
|
-
|
13
|
-
describe( 'Duplicating blocks', () => {
|
14
|
-
beforeEach( async () => {
|
15
|
-
await createNewPost();
|
16
|
-
} );
|
17
|
-
|
18
|
-
it( 'should duplicate blocks using the block settings menu', async () => {
|
19
|
-
await insertBlock( 'Paragraph' );
|
20
|
-
await page.keyboard.type( 'Clone me' );
|
21
|
-
|
22
|
-
// Select the test we just typed
|
23
|
-
// This doesn't do anything but we previously had a duplicationi bug
|
24
|
-
// When the selection was not collapsed.
|
25
|
-
await pressKeyWithModifier( 'primary', 'a' );
|
26
|
-
|
27
|
-
await clickBlockToolbarButton( 'Options' );
|
28
|
-
await clickMenuItem( 'Duplicate' );
|
29
|
-
|
30
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
31
|
-
} );
|
32
|
-
|
33
|
-
it( 'should duplicate blocks using the keyboard shortcut', async () => {
|
34
|
-
await insertBlock( 'Paragraph' );
|
35
|
-
await page.keyboard.type( 'Clone me' );
|
36
|
-
|
37
|
-
// Select the test we just typed
|
38
|
-
// This doesn't do anything but we previously had a duplicationi bug
|
39
|
-
// When the selection was not collapsed.
|
40
|
-
await pressKeyWithModifier( 'primary', 'a' );
|
41
|
-
|
42
|
-
// Duplicate using the keyboard shortccut.
|
43
|
-
await pressKeyWithModifier( 'primaryShift', 'd' );
|
44
|
-
|
45
|
-
expect( await getEditedPostContent() ).toMatchSnapshot();
|
46
|
-
} );
|
47
|
-
} );
|