@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.
Files changed (53) hide show
  1. package/package.json +7 -7
  2. package/plugins/cpt-locking.php +28 -4
  3. package/specs/editor/blocks/__snapshots__/quote.test.js.snap +37 -131
  4. package/specs/editor/blocks/gallery.test.js +1 -1
  5. package/specs/editor/blocks/navigation.test.js +11 -50
  6. package/specs/editor/blocks/quote.test.js +9 -104
  7. package/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +24 -8
  8. package/specs/editor/plugins/__snapshots__/inner-blocks-render-appender.test.js.snap +6 -2
  9. package/specs/editor/plugins/__snapshots__/templates.test.js.snap +6 -2
  10. package/specs/editor/plugins/block-variations.test.js +2 -0
  11. package/specs/editor/plugins/cpt-locking.test.js +3 -3
  12. package/specs/editor/plugins/iframed-block.test.js +3 -2
  13. package/specs/editor/plugins/iframed-masonry-block.test.js +3 -2
  14. package/specs/editor/plugins/inner-blocks-render-appender.test.js +3 -0
  15. package/specs/editor/plugins/meta-boxes.test.js +1 -1
  16. package/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +0 -16
  17. package/specs/editor/various/__snapshots__/writing-flow.test.js.snap +3 -3
  18. package/specs/editor/various/block-switcher.test.js +1 -3
  19. package/specs/editor/various/compatibility-classic-editor.test.js +1 -1
  20. package/specs/editor/various/datepicker.test.js +9 -11
  21. package/specs/editor/various/links.test.js +3 -3
  22. package/specs/editor/various/multi-block-selection.test.js +2 -29
  23. package/specs/editor/various/post-visibility.test.js +4 -4
  24. package/specs/editor/various/reusable-blocks.test.js +2 -0
  25. package/specs/editor/various/scheduling.test.js +2 -2
  26. package/specs/editor/various/{sidebar-permalink-panel.test.js → sidebar-permalink.test.js} +9 -19
  27. package/specs/editor/various/sidebar.test.js +4 -6
  28. package/specs/editor/various/typewriter.test.js +2 -2
  29. package/specs/editor/various/writing-flow.test.js +74 -1
  30. package/specs/editor/blocks/__snapshots__/buttons.test.js.snap +0 -33
  31. package/specs/editor/blocks/__snapshots__/list.test.js.snap +0 -337
  32. package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +0 -13
  33. package/specs/editor/blocks/__snapshots__/table.test.js.snap +0 -61
  34. package/specs/editor/blocks/buttons.test.js +0 -95
  35. package/specs/editor/blocks/comments.test.js +0 -131
  36. package/specs/editor/blocks/list.test.js +0 -542
  37. package/specs/editor/blocks/spacer.test.js +0 -48
  38. package/specs/editor/blocks/table.test.js +0 -295
  39. package/specs/editor/plugins/__snapshots__/format-api.test.js.snap +0 -7
  40. package/specs/editor/plugins/__snapshots__/hooks-api.test.js.snap +0 -3
  41. package/specs/editor/plugins/format-api.test.js +0 -36
  42. package/specs/editor/plugins/hooks-api.test.js +0 -44
  43. package/specs/editor/various/__snapshots__/rtl.test.js.snap +0 -63
  44. package/specs/editor/various/block-mover.test.js +0 -42
  45. package/specs/editor/various/preview.test.js +0 -425
  46. package/specs/editor/various/rtl.test.js +0 -129
  47. package/specs/site-editor/style-variations.test.js +0 -213
  48. package/themes/style-variations/block-templates/index.html +0 -11
  49. package/themes/style-variations/index.php +0 -0
  50. package/themes/style-variations/style.css +0 -15
  51. package/themes/style-variations/styles/pink.json +0 -33
  52. package/themes/style-variations/styles/yellow.json +0 -12
  53. package/themes/style-variations/theme.json +0 -8
@@ -1,337 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`List can be converted to a quote 1`] = `
4
- "<!-- wp:quote -->
5
- <blockquote class=\\"wp-block-quote\\"><p>one</p><p>two</p></blockquote>
6
- <!-- /wp:quote -->"
7
- `;
8
-
9
- exports[`List can be converted to paragraphs 1`] = `
10
- "<!-- wp:paragraph -->
11
- <p>one</p>
12
- <!-- /wp:paragraph -->
13
-
14
- <!-- wp:paragraph -->
15
- <p>two</p>
16
- <!-- /wp:paragraph -->"
17
- `;
18
-
19
- exports[`List can be converted when nested to paragraphs 1`] = `
20
- "<!-- wp:paragraph -->
21
- <p>one</p>
22
- <!-- /wp:paragraph -->
23
-
24
- <!-- wp:paragraph -->
25
- <p>two</p>
26
- <!-- /wp:paragraph -->"
27
- `;
28
-
29
- exports[`List can be created by converting a paragraph 1`] = `
30
- "<!-- wp:list -->
31
- <ul><li>test</li></ul>
32
- <!-- /wp:list -->"
33
- `;
34
-
35
- exports[`List can be created by converting a paragraph with line breaks 1`] = `
36
- "<!-- wp:list -->
37
- <ul><li>one</li><li>two</li></ul>
38
- <!-- /wp:list -->"
39
- `;
40
-
41
- exports[`List can be created by converting a quote 1`] = `
42
- "<!-- wp:list -->
43
- <ul><li>one</li><li>two</li></ul>
44
- <!-- /wp:list -->"
45
- `;
46
-
47
- exports[`List can be created by converting multiple paragraphs 1`] = `
48
- "<!-- wp:list -->
49
- <ul><li>one</li><li>two</li></ul>
50
- <!-- /wp:list -->"
51
- `;
52
-
53
- exports[`List can be created by typing "/list" 1`] = `
54
- "<!-- wp:list -->
55
- <ul><li>I’m a list</li></ul>
56
- <!-- /wp:list -->"
57
- `;
58
-
59
- exports[`List can be created by typing an asterisk in front of text of a paragraph block 1`] = `
60
- "<!-- wp:list -->
61
- <ul><li>test</li></ul>
62
- <!-- /wp:list -->"
63
- `;
64
-
65
- exports[`List can be created by using a number at the start of a paragraph block 1`] = `
66
- "<!-- wp:list {\\"ordered\\":true} -->
67
- <ol><li>A list item</li></ol>
68
- <!-- /wp:list -->"
69
- `;
70
-
71
- exports[`List can be created by using an asterisk at the start of a paragraph block 1`] = `
72
- "<!-- wp:list -->
73
- <ul><li>A list item</li><li>Another list item</li></ul>
74
- <!-- /wp:list -->"
75
- `;
76
-
77
- exports[`List can undo asterisk transform 1`] = `
78
- "<!-- wp:paragraph -->
79
- <p>1. </p>
80
- <!-- /wp:paragraph -->"
81
- `;
82
-
83
- exports[`List first empty list item is graciously removed 1`] = `
84
- "<!-- wp:list -->
85
- <ul><li>2</li></ul>
86
- <!-- /wp:list -->"
87
- `;
88
-
89
- exports[`List should be immeadiately saved on indentation 1`] = `
90
- "<!-- wp:list -->
91
- <ul><li>one<ul><li></li></ul></li></ul>
92
- <!-- /wp:list -->"
93
- `;
94
-
95
- exports[`List should change the base list type 1`] = `
96
- "<!-- wp:list {\\"ordered\\":true} -->
97
- <ol><li></li></ol>
98
- <!-- /wp:list -->"
99
- `;
100
-
101
- exports[`List should change the indented list type 1`] = `
102
- "<!-- wp:list -->
103
- <ul><li>a<ol><li>1</li></ol></li></ul>
104
- <!-- /wp:list -->"
105
- `;
106
-
107
- exports[`List should create and remove indented list with keyboard only 1`] = `
108
- "<!-- wp:list -->
109
- <ul><li>1<ul><li>a<ul><li>i</li></ul></li></ul></li></ul>
110
- <!-- /wp:list -->"
111
- `;
112
-
113
- exports[`List should create and remove indented list with keyboard only 2`] = `
114
- "<!-- wp:list -->
115
- <ul><li>1<ul><li>a</li><li></li></ul></li></ul>
116
- <!-- /wp:list -->"
117
- `;
118
-
119
- exports[`List should create and remove indented list with keyboard only 3`] = `
120
- "<!-- wp:list -->
121
- <ul><li>1<ul><li>a</li></ul></li><li></li></ul>
122
- <!-- /wp:list -->"
123
- `;
124
-
125
- exports[`List should create and remove indented list with keyboard only 4`] = `
126
- "<!-- wp:list -->
127
- <ul><li>1<ul><li>a</li></ul></li></ul>
128
- <!-- /wp:list -->"
129
- `;
130
-
131
- exports[`List should create and remove indented list with keyboard only 5`] = `
132
- "<!-- wp:list -->
133
- <ul><li>1</li><li></li></ul>
134
- <!-- /wp:list -->"
135
- `;
136
-
137
- exports[`List should create and remove indented list with keyboard only 6`] = `
138
- "<!-- wp:list -->
139
- <ul><li>1</li></ul>
140
- <!-- /wp:list -->"
141
- `;
142
-
143
- exports[`List should create and remove indented list with keyboard only 7`] = `""`;
144
-
145
- exports[`List should create paragraph on split at end and merge back with content 1`] = `
146
- "<!-- wp:list -->
147
- <ul><li>one</li></ul>
148
- <!-- /wp:list -->
149
-
150
- <!-- wp:paragraph -->
151
- <p></p>
152
- <!-- /wp:paragraph -->"
153
- `;
154
-
155
- exports[`List should create paragraph on split at end and merge back with content 2`] = `
156
- "<!-- wp:list -->
157
- <ul><li>one</li><li>two</li></ul>
158
- <!-- /wp:list -->"
159
- `;
160
-
161
- exports[`List should indent and outdent level 1 1`] = `
162
- "<!-- wp:list -->
163
- <ul><li>a<ul><li>1</li></ul></li></ul>
164
- <!-- /wp:list -->"
165
- `;
166
-
167
- exports[`List should indent and outdent level 1 2`] = `
168
- "<!-- wp:list -->
169
- <ul><li>a</li><li>1</li></ul>
170
- <!-- /wp:list -->"
171
- `;
172
-
173
- exports[`List should indent and outdent level 2 1`] = `
174
- "<!-- wp:list -->
175
- <ul><li>a<ul><li>1<ul><li>i</li></ul></li></ul></li></ul>
176
- <!-- /wp:list -->"
177
- `;
178
-
179
- exports[`List should indent and outdent level 2 2`] = `
180
- "<!-- wp:list -->
181
- <ul><li>a<ul><li>1</li><li>i</li></ul></li></ul>
182
- <!-- /wp:list -->"
183
- `;
184
-
185
- exports[`List should indent and outdent level 2 3`] = `
186
- "<!-- wp:list -->
187
- <ul><li>a<ul><li>1</li></ul></li><li>i</li></ul>
188
- <!-- /wp:list -->"
189
- `;
190
-
191
- exports[`List should insert a line break on shift+enter 1`] = `
192
- "<!-- wp:list -->
193
- <ul><li>a<br></li></ul>
194
- <!-- /wp:list -->"
195
- `;
196
-
197
- exports[`List should insert a line break on shift+enter in a non trailing list item 1`] = `
198
- "<!-- wp:list -->
199
- <ul><li>a</li><li>b<br></li><li>c</li></ul>
200
- <!-- /wp:list -->"
201
- `;
202
-
203
- exports[`List should not change the contents when you change the list type to Unordered 1`] = `"<li>a</li><li>b</li><li>c</li>"`;
204
-
205
- exports[`List should not change the contents when you change the list type to Ordered 1`] = `"<li>1</li><li>2</li><li>3</li>"`;
206
-
207
- exports[`List should not indent list on space with modifier 1`] = `
208
- "<!-- wp:list -->
209
- <ul><li>1</li><li> </li></ul>
210
- <!-- /wp:list -->"
211
- `;
212
-
213
- exports[`List should not transform lines in block when transforming multiple blocks 1`] = `
214
- "<!-- wp:list -->
215
- <ul><li>one<br>...</li><li>two</li></ul>
216
- <!-- /wp:list -->"
217
- `;
218
-
219
- exports[`List should not undo asterisk transform with backspace after selection change 1`] = `""`;
220
-
221
- exports[`List should not undo asterisk transform with backspace after typing 1`] = `""`;
222
-
223
- exports[`List should only convert to list when shortcut ends with space 1`] = `
224
- "<!-- wp:paragraph -->
225
- <p>* </p>
226
- <!-- /wp:paragraph -->"
227
- `;
228
-
229
- exports[`List should outdent with children 1`] = `
230
- "<!-- wp:list -->
231
- <ul><li>a<ul><li>b<ul><li>c</li></ul></li></ul></li></ul>
232
- <!-- /wp:list -->"
233
- `;
234
-
235
- exports[`List should outdent with children 2`] = `
236
- "<!-- wp:list -->
237
- <ul><li>a</li><li>b<ul><li>c</li></ul></li></ul>
238
- <!-- /wp:list -->"
239
- `;
240
-
241
- exports[`List should place the caret in the right place with nested list 1`] = `
242
- "<!-- wp:list -->
243
- <ul><li>1</li><li>2<ul><li>a</li></ul></li></ul>
244
- <!-- /wp:list -->"
245
- `;
246
-
247
- exports[`List should preserve indentation after merging backward and forward 1`] = `
248
- "<!-- wp:list -->
249
- <ul><li>1<ul><li>2</li><li>3</li></ul></li><li></li></ul>
250
- <!-- /wp:list -->"
251
- `;
252
-
253
- exports[`List should preserve indentation after merging backward and forward 2`] = `
254
- "<!-- wp:list -->
255
- <ul><li>1<ul><li>2</li><li>3</li></ul></li></ul>
256
- <!-- /wp:list -->"
257
- `;
258
-
259
- exports[`List should split indented list item 1`] = `
260
- "<!-- wp:list -->
261
- <ul><li>one<ul><li>two</li><li>three</li></ul></li></ul>
262
- <!-- /wp:list -->"
263
- `;
264
-
265
- exports[`List should split into two ordered lists with paragraph 1`] = `
266
- "<!-- wp:list {\\"ordered\\":true} -->
267
- <ol><li>one</li></ol>
268
- <!-- /wp:list -->
269
-
270
- <!-- wp:paragraph -->
271
- <p></p>
272
- <!-- /wp:paragraph -->
273
-
274
- <!-- wp:list {\\"ordered\\":true} -->
275
- <ol><li>two</li></ol>
276
- <!-- /wp:list -->"
277
- `;
278
-
279
- exports[`List should split into two with paragraph and merge lists 1`] = `
280
- "<!-- wp:list -->
281
- <ul><li>one</li><li></li><li>two</li></ul>
282
- <!-- /wp:list -->"
283
- `;
284
-
285
- exports[`List should split into two with paragraph and merge lists 2`] = `
286
- "<!-- wp:list -->
287
- <ul><li>one</li></ul>
288
- <!-- /wp:list -->
289
-
290
- <!-- wp:paragraph -->
291
- <p></p>
292
- <!-- /wp:paragraph -->
293
-
294
- <!-- wp:list -->
295
- <ul><li>two</li></ul>
296
- <!-- /wp:list -->"
297
- `;
298
-
299
- exports[`List should split into two with paragraph and merge lists 3`] = `
300
- "<!-- wp:list -->
301
- <ul><li>one</li><li></li></ul>
302
- <!-- /wp:list -->
303
-
304
- <!-- wp:list -->
305
- <ul><li>two</li></ul>
306
- <!-- /wp:list -->"
307
- `;
308
-
309
- exports[`List should undo asterisk transform with backspace 1`] = `
310
- "<!-- wp:paragraph -->
311
- <p>* </p>
312
- <!-- /wp:paragraph -->"
313
- `;
314
-
315
- exports[`List should undo asterisk transform with backspace after selection changes 1`] = `
316
- "<!-- wp:paragraph -->
317
- <p>* </p>
318
- <!-- /wp:paragraph -->"
319
- `;
320
-
321
- exports[`List should undo asterisk transform with backspace after selection changes without requestIdleCallback 1`] = `
322
- "<!-- wp:paragraph -->
323
- <p>* </p>
324
- <!-- /wp:paragraph -->"
325
- `;
326
-
327
- exports[`List should undo asterisk transform with backspace setting isTyping state 1`] = `
328
- "<!-- wp:paragraph -->
329
- <p>* </p>
330
- <!-- /wp:paragraph -->"
331
- `;
332
-
333
- exports[`List should undo asterisk transform with escape 1`] = `
334
- "<!-- wp:paragraph -->
335
- <p>* </p>
336
- <!-- /wp:paragraph -->"
337
- `;
@@ -1,13 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Spacer can be created by typing "/spacer" 1`] = `
4
- "<!-- wp:spacer -->
5
- <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
6
- <!-- /wp:spacer -->"
7
- `;
8
-
9
- exports[`Spacer can be resized using the drag handle and remains selected after being dragged 1`] = `
10
- "<!-- wp:spacer {\\"height\\":\\"150px\\"} -->
11
- <div style=\\"height:150px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
12
- <!-- /wp:spacer -->"
13
- `;
@@ -1,61 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Table allows a caption to be added 1`] = `
4
- "<!-- wp:table -->
5
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody></table><figcaption>Caption!</figcaption></figure>
6
- <!-- /wp:table -->"
7
- `;
8
-
9
- exports[`Table allows adding and deleting columns across the table header, body and footer 1`] = `
10
- "<!-- wp:table -->
11
- <figure class=\\"wp-block-table\\"><table><thead><tr><th></th><th></th><th></th></tr></thead><tbody><tr><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody><tfoot><tr><td></td><td></td><td></td></tr></tfoot></table></figure>
12
- <!-- /wp:table -->"
13
- `;
14
-
15
- exports[`Table allows adding and deleting columns across the table header, body and footer 2`] = `
16
- "<!-- wp:table -->
17
- <figure class=\\"wp-block-table\\"><table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td></td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td></td><td></td></tr></tfoot></table></figure>
18
- <!-- /wp:table -->"
19
- `;
20
-
21
- exports[`Table allows cells to be selected when the cell area outside of the RichText is clicked 1`] = `
22
- "<!-- wp:table {\\"hasFixedLayout\\":true} -->
23
- <figure class=\\"wp-block-table\\"><table class=\\"has-fixed-layout\\"><tbody><tr><td><br><br><br><br></td><td>Second cell.</td></tr><tr><td></td><td></td></tr></tbody></table></figure>
24
- <!-- /wp:table -->"
25
- `;
26
-
27
- exports[`Table allows columns to be aligned 1`] = `
28
- "<!-- wp:table -->
29
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>None</td><td class=\\"has-text-align-left\\" data-align=\\"left\\">To the left</td><td class=\\"has-text-align-center\\" data-align=\\"center\\">Centered</td><td class=\\"has-text-align-right\\" data-align=\\"right\\">Right aligned</td></tr><tr><td></td><td class=\\"has-text-align-left\\" data-align=\\"left\\"></td><td class=\\"has-text-align-center\\" data-align=\\"center\\"></td><td class=\\"has-text-align-right\\" data-align=\\"right\\"></td></tr></tbody></table></figure>
30
- <!-- /wp:table -->"
31
- `;
32
-
33
- exports[`Table allows header and footer rows to be switched on and off 1`] = `
34
- "<!-- wp:table -->
35
- <figure class=\\"wp-block-table\\"><table><thead><tr><th>header</th><th></th></tr></thead><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody><tfoot><tr><td>footer</td><td></td></tr></tfoot></table></figure>
36
- <!-- /wp:table -->"
37
- `;
38
-
39
- exports[`Table allows header and footer rows to be switched on and off 2`] = `
40
- "<!-- wp:table -->
41
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>body</td><td></td></tr><tr><td></td><td></td></tr></tbody></table></figure>
42
- <!-- /wp:table -->"
43
- `;
44
-
45
- exports[`Table allows text to by typed into cells 1`] = `
46
- "<!-- wp:table -->
47
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>This</td><td>is</td></tr><tr><td>table</td><td>block</td></tr></tbody></table></figure>
48
- <!-- /wp:table -->"
49
- `;
50
-
51
- exports[`Table displays a form for choosing the row and column count of the table 1`] = `
52
- "<!-- wp:table -->
53
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></tbody></table></figure>
54
- <!-- /wp:table -->"
55
- `;
56
-
57
- exports[`Table up and down arrow navigation 1`] = `
58
- "<!-- wp:table -->
59
- <figure class=\\"wp-block-table\\"><table><tbody><tr><td>1</td><td>4</td></tr><tr><td>2</td><td>3</td></tr></tbody></table></figure>
60
- <!-- /wp:table -->"
61
- `;
@@ -1,95 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- insertBlock,
6
- getEditedPostContent,
7
- createNewPost,
8
- pressKeyWithModifier,
9
- clickBlockAppender,
10
- } from '@wordpress/e2e-test-utils';
11
-
12
- describe( 'Buttons', () => {
13
- beforeEach( async () => {
14
- await createNewPost();
15
- } );
16
-
17
- it( 'has focus on button content', async () => {
18
- await insertBlock( 'Buttons' );
19
- await page.keyboard.type( 'Content' );
20
-
21
- expect( await getEditedPostContent() ).toMatchSnapshot();
22
- } );
23
-
24
- it( 'has focus on button content (slash inserter)', async () => {
25
- await clickBlockAppender();
26
- await page.keyboard.type( '/buttons' );
27
- await page.keyboard.press( 'Enter' );
28
- await page.keyboard.type( 'Content' );
29
-
30
- expect( await getEditedPostContent() ).toMatchSnapshot();
31
- } );
32
-
33
- it( 'dismisses link editor when escape is pressed', async () => {
34
- // Regression: https://github.com/WordPress/gutenberg/pull/19885
35
- await insertBlock( 'Buttons' );
36
- await pressKeyWithModifier( 'primary', 'k' );
37
- await page.waitForFunction(
38
- () => !! document.activeElement.closest( '.block-editor-url-input' )
39
- );
40
- await page.keyboard.press( 'Escape' );
41
- await page.waitForFunction(
42
- () =>
43
- document.activeElement ===
44
- document.querySelector( '.block-editor-rich-text__editable' )
45
- );
46
- await page.keyboard.type( 'WordPress' );
47
-
48
- expect( await getEditedPostContent() ).toMatchSnapshot();
49
- } );
50
-
51
- it( 'moves focus from the link editor back to the button when escape is pressed after the URL has been submitted', async () => {
52
- // Regression: https://github.com/WordPress/gutenberg/issues/34307
53
- await insertBlock( 'Buttons' );
54
- await pressKeyWithModifier( 'primary', 'k' );
55
- await page.waitForFunction(
56
- () => !! document.activeElement.closest( '.block-editor-url-input' )
57
- );
58
- await page.keyboard.type( 'https://example.com' );
59
- await page.keyboard.press( 'Enter' );
60
- await page.waitForFunction(
61
- () =>
62
- document.activeElement ===
63
- document.querySelector(
64
- '.block-editor-link-control a[href="https://example.com"]'
65
- )
66
- );
67
- await page.keyboard.press( 'Escape' );
68
-
69
- // Focus should move from the link control to the button block's text.
70
- await page.waitForFunction(
71
- () =>
72
- document.activeElement ===
73
- document.querySelector( '[aria-label="Button text"]' )
74
- );
75
-
76
- // The link control should still be visible when a URL is set.
77
- const linkControl = await page.$( '.block-editor-link-control' );
78
- expect( linkControl ).toBeTruthy();
79
- } );
80
-
81
- it( 'can jump to the link editor using the keyboard shortcut', async () => {
82
- await insertBlock( 'Buttons' );
83
- await page.keyboard.type( 'WordPress' );
84
- await pressKeyWithModifier( 'primary', 'k' );
85
- await page.keyboard.type( 'https://www.wordpress.org/' );
86
- await page.keyboard.press( 'Enter' );
87
- // Make sure that the dialog is still opened, and that focus is retained
88
- // within (focusing on the link preview).
89
- await page.waitForSelector(
90
- ':focus.block-editor-link-control__search-item-title'
91
- );
92
-
93
- expect( await getEditedPostContent() ).toMatchSnapshot();
94
- } );
95
- } );
@@ -1,131 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- activateTheme,
6
- createNewPost,
7
- insertBlock,
8
- pressKeyTimes,
9
- publishPost,
10
- setOption,
11
- trashAllComments,
12
- } from '@wordpress/e2e-test-utils';
13
-
14
- describe( 'Comments', () => {
15
- let previousPageComments,
16
- previousCommentsPerPage,
17
- previousDefaultCommentsPage;
18
- beforeAll( async () => {
19
- await activateTheme( 'emptytheme' );
20
- previousPageComments = await setOption( 'page_comments', '1' );
21
- previousCommentsPerPage = await setOption( 'comments_per_page', '1' );
22
- previousDefaultCommentsPage = await setOption(
23
- 'default_comments_page',
24
- 'newest'
25
- );
26
- } );
27
- it( 'We show no results message if there are no comments', async () => {
28
- await trashAllComments();
29
- await createNewPost();
30
- await insertBlock( 'Comments' );
31
- await page.waitForXPath( '//p[contains(text(), "No results found.")]' );
32
- } );
33
- it( 'Pagination links are working as expected', async () => {
34
- await createNewPost();
35
- await insertBlock( 'Comments' );
36
- await publishPost();
37
- // Visit the post that was just published.
38
- await page.click(
39
- '.post-publish-panel__postpublish-buttons .is-primary'
40
- );
41
-
42
- // TODO: We can extract this into a util once we find we need it elsewhere.
43
- // Create three comments for that post.
44
- for ( let i = 0; i < 3; i++ ) {
45
- await page.waitForSelector( 'textarea#comment' );
46
- await page.click( 'textarea#comment' );
47
- await page.type(
48
- `textarea#comment`,
49
- `This is an automated comment - ${ i }`
50
- );
51
- await pressKeyTimes( 'Tab', 1 );
52
- await Promise.all( [
53
- page.keyboard.press( 'Enter' ),
54
- page.waitForNavigation( { waitUntil: 'networkidle0' } ),
55
- ] );
56
- }
57
-
58
- // We check that there is a previous comments page link.
59
- expect(
60
- await page.$( '.wp-block-comments-pagination-previous' )
61
- ).not.toBeNull();
62
- expect(
63
- await page.$( '.wp-block-comments-pagination-next' )
64
- ).toBeNull();
65
-
66
- await Promise.all( [
67
- page.click( '.wp-block-comments-pagination-previous' ),
68
- page.waitForNavigation( { waitUntil: 'networkidle0' } ),
69
- ] );
70
-
71
- // We check that there are a previous and a next link.
72
- expect(
73
- await page.$( '.wp-block-comments-pagination-previous' )
74
- ).not.toBeNull();
75
- expect(
76
- await page.$( '.wp-block-comments-pagination-next' )
77
- ).not.toBeNull();
78
-
79
- await Promise.all( [
80
- page.click( '.wp-block-comments-pagination-previous' ),
81
- page.waitForNavigation( { waitUntil: 'networkidle0' } ),
82
- ] );
83
-
84
- // We check that there is only have a next link
85
- expect(
86
- await page.$( '.wp-block-comments-pagination-previous' )
87
- ).toBeNull();
88
- expect(
89
- await page.$( '.wp-block-comments-pagination-next' )
90
- ).not.toBeNull();
91
- } );
92
- it( 'Pagination links are not appearing if break comments is not enabled', async () => {
93
- await setOption( 'page_comments', '0' );
94
- await createNewPost();
95
- await insertBlock( 'Comments' );
96
- await publishPost();
97
- // Visit the post that was just published.
98
- await page.click(
99
- '.post-publish-panel__postpublish-buttons .is-primary'
100
- );
101
-
102
- // Create three comments for that post.
103
- for ( let i = 0; i < 3; i++ ) {
104
- await page.waitForSelector( 'textarea#comment' );
105
- await page.click( 'textarea#comment' );
106
- await page.type(
107
- `textarea#comment`,
108
- `This is an automated comment - ${ i }`
109
- );
110
- await pressKeyTimes( 'Tab', 1 );
111
- await Promise.all( [
112
- page.keyboard.press( 'Enter' ),
113
- page.waitForNavigation( { waitUntil: 'networkidle0' } ),
114
- ] );
115
- }
116
- // We check that there are no comments page link.
117
- expect(
118
- await page.$( '.wp-block-comments-pagination-previous' )
119
- ).toBeNull();
120
- expect(
121
- await page.$( '.wp-block-comments-pagination-next' )
122
- ).toBeNull();
123
- } );
124
- afterAll( async () => {
125
- await trashAllComments();
126
- await activateTheme( 'twentytwentyone' );
127
- await setOption( 'page_comments', previousPageComments );
128
- await setOption( 'comments_per_page', previousCommentsPerPage );
129
- await setOption( 'default_comments_page', previousDefaultCommentsPage );
130
- } );
131
- } );