@wordpress/e2e-tests 3.0.1-next.33ec3857e2.0 → 3.0.4

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 (59) hide show
  1. package/CHANGELOG.md +2 -1
  2. package/LICENSE.md +1 -1
  3. package/README.md +31 -19
  4. package/config/is-gutenberg-plugin.js +6 -0
  5. package/jest.config.js +1 -1
  6. package/jest.performance.config.js +1 -1
  7. package/mu-plugins/enable-templates-ui.php +24 -0
  8. package/package.json +9 -9
  9. package/plugins/plugins-api/error-boundary.js +11 -0
  10. package/plugins/plugins-error-boundary.php +27 -0
  11. package/plugins/query-block.php +2 -2
  12. package/specs/editor/blocks/__snapshots__/image.test.js.snap +6 -6
  13. package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +4 -2
  14. package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
  15. package/specs/editor/blocks/classic.test.js +5 -2
  16. package/specs/editor/blocks/cover.test.js +7 -3
  17. package/specs/editor/blocks/gallery.test.js +6 -1
  18. package/specs/editor/blocks/heading.test.js +1 -11
  19. package/specs/editor/blocks/navigation.test.js +279 -240
  20. package/specs/editor/plugins/__snapshots__/plugins-api.test.js.snap +2 -2
  21. package/specs/editor/plugins/block-variations.test.js +3 -3
  22. package/specs/editor/plugins/iframed-inline-styles.test.js +0 -6
  23. package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -4
  24. package/specs/editor/plugins/plugins-api.test.js +30 -0
  25. package/specs/editor/plugins/templates.test.js +1 -7
  26. package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
  27. package/specs/editor/various/__snapshots__/inserting-blocks.test.js.snap +1 -1
  28. package/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +35 -0
  29. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
  30. package/specs/editor/various/font-size-picker.test.js +57 -11
  31. package/specs/editor/various/fullscreen-mode.test.js +1 -1
  32. package/specs/editor/various/keep-styles-on-block-transforms.test.js +81 -0
  33. package/specs/editor/various/post-editor-template-mode.test.js +1 -1
  34. package/specs/editor/various/post-visibility.test.js +54 -0
  35. package/specs/editor/various/preview.test.js +66 -1
  36. package/specs/editor/various/reusable-blocks.test.js +52 -5
  37. package/specs/editor/various/style-variation.test.js +9 -5
  38. package/specs/editor/various/undo.test.js +21 -0
  39. package/specs/performance/site-editor.test.js +3 -4
  40. package/specs/site-editor/document-settings.test.js +12 -14
  41. package/specs/site-editor/multi-entity-editing.test.js +14 -16
  42. package/specs/site-editor/multi-entity-saving.test.js +18 -27
  43. package/specs/site-editor/settings-sidebar.test.js +7 -12
  44. package/specs/site-editor/site-editor-export.test.js +9 -10
  45. package/specs/site-editor/site-editor-inserter.test.js +7 -9
  46. package/specs/site-editor/style-variations.test.js +211 -0
  47. package/specs/site-editor/template-part.test.js +14 -22
  48. package/specs/site-editor/template-revert.test.js +31 -37
  49. package/specs/widgets/customizing-widgets.test.js +3 -23
  50. package/specs/widgets/editing-widgets.test.js +36 -12
  51. package/themes/style-variations/block-templates/index.html +11 -0
  52. package/themes/style-variations/index.php +0 -0
  53. package/themes/style-variations/style.css +15 -0
  54. package/themes/style-variations/styles/pink.json +33 -0
  55. package/themes/style-variations/styles/yellow.json +12 -0
  56. package/themes/style-variations/theme.json +8 -0
  57. package/config/gutenberg-phase.js +0 -9
  58. package/specs/editor/various/__snapshots__/style-variation.test.js.snap +0 -7
  59. package/specs/site-editor/utils.js +0 -153
@@ -2,6 +2,6 @@
2
2
 
3
3
  exports[`Using Plugins API Document Setting Custom Panel Should render a custom panel inside Document Setting sidebar 1`] = `"My Custom Panel"`;
4
4
 
5
- exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
5
+ exports[`Using Plugins API Sidebar Medium screen Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
6
6
 
7
- exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
7
+ exports[`Using Plugins API Sidebar Should open plugins sidebar using More Menu item and render content 1`] = `"<div class=\\"components-panel__header interface-complementary-area-header__small\\"><span class=\\"interface-complementary-area-header__small-title\\">(no title)</span><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel__header interface-complementary-area-header\\" tabindex=\\"-1\\"><strong>Plugin sidebar title</strong><button type=\\"button\\" aria-pressed=\\"true\\" aria-expanded=\\"true\\" class=\\"components-button interface-complementary-area__pin-unpin-item is-pressed has-icon\\" aria-label=\\"Unpin from toolbar\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z\\"></path></svg></button><button type=\\"button\\" class=\\"components-button has-icon\\" aria-label=\\"Close plugin\\"><svg width=\\"24\\" height=\\"24\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 24 24\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z\\"></path></svg></button></div><div class=\\"components-panel\\"><div class=\\"components-panel__body sidebar-title-plugin-panel is-opened\\"><div class=\\"components-panel__row\\"><label for=\\"title-plain-text\\">Title:</label><textarea class=\\"block-editor-plain-text\\" id=\\"title-plain-text\\" placeholder=\\"(no title)\\" rows=\\"1\\" style=\\"overflow: hidden; overflow-wrap: break-word; resize: none; height: 18px;\\"></textarea></div><div class=\\"components-panel__row\\"><button type=\\"button\\" class=\\"components-button is-primary\\">Reset</button></div></div></div>"`;
@@ -104,7 +104,7 @@ describe( 'Block variations', () => {
104
104
  'Display block breadcrumbs',
105
105
  true
106
106
  );
107
- await toggleMoreMenu();
107
+ await toggleMoreMenu( 'close' );
108
108
  } );
109
109
 
110
110
  afterEach( async () => {
@@ -113,7 +113,7 @@ describe( 'Block variations', () => {
113
113
  'Display block breadcrumbs',
114
114
  false
115
115
  );
116
- await toggleMoreMenu();
116
+ await toggleMoreMenu( 'close' );
117
117
  } );
118
118
 
119
119
  const getActiveBreadcrumb = async () =>
@@ -181,7 +181,7 @@ describe( 'Block variations', () => {
181
181
  ).toBeTruthy();
182
182
  const description = await getBlockCardDescription();
183
183
  expect( description ).toEqual(
184
- 'Start with the building block of all narrative.'
184
+ 'Start with the basic building block of all narrative.'
185
185
  );
186
186
  } );
187
187
  } );
@@ -57,11 +57,5 @@ describe( 'iframed inline styles', () => {
57
57
  expect( await getComputedStyle( canvas(), 'border-width' ) ).toBe(
58
58
  '2px'
59
59
  );
60
-
61
- expect( console ).toHaveWarned(
62
- `Stylesheet iframed-inline-styles-compat-style-css was not properly added.
63
- For blocks, use the block API's style (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#style) or editorStyle (https://developer.wordpress.org/block-editor/reference-guides/block-api/block-metadata/#editor-style).
64
- For themes, use add_editor_style (https://developer.wordpress.org/block-editor/how-to-guides/themes/theme-support/#editor-styles). <link rel="stylesheet" id="iframed-inline-styles-compat-style-css" href="http://localhost:8889/wp-content/plugins/gutenberg-test-plugins/iframed-inline-styles/compat-style.css?ver=1626189899" media="all">`
65
- );
66
60
  } );
67
61
  } );
@@ -63,9 +63,5 @@ describe( 'iframed multiple block stylesheets', () => {
63
63
  expect( await getComputedStyle( canvas(), 'background-color' ) ).toBe(
64
64
  'rgb(0, 0, 0)'
65
65
  );
66
-
67
- // Skip warnings related to block-styles enqueing and the use of add_editor_style.
68
- // The issue is tracked on https://github.com/WordPress/gutenberg/issues/33212.
69
- expect( console ).toHaveWarned();
70
66
  } );
71
67
  } );
@@ -156,4 +156,34 @@ describe( 'Using Plugins API', () => {
156
156
  expect( pluginDocumentSettingsText ).toMatchSnapshot();
157
157
  } );
158
158
  } );
159
+
160
+ describe( 'Error Boundary', () => {
161
+ beforeAll( async () => {
162
+ await activatePlugin(
163
+ 'gutenberg-test-plugin-plugins-error-boundary'
164
+ );
165
+ } );
166
+
167
+ afterAll( async () => {
168
+ await deactivatePlugin(
169
+ 'gutenberg-test-plugin-plugins-error-boundary'
170
+ );
171
+ } );
172
+
173
+ it( 'Should create notice using plugin error boundary callback', async () => {
174
+ const noticeContent = await page.waitForSelector(
175
+ '.is-error .components-notice__content'
176
+ );
177
+ expect(
178
+ await page.evaluate(
179
+ ( _noticeContent ) => _noticeContent.firstChild.nodeValue,
180
+ noticeContent
181
+ )
182
+ ).toEqual(
183
+ 'The "my-error-plugin" plugin has encountered an error and cannot be rendered.'
184
+ );
185
+
186
+ expect( console ).toHaveErrored();
187
+ } );
188
+ } );
159
189
  } );
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import {
5
5
  activatePlugin,
6
- clickBlockAppender,
7
6
  createNewPost,
8
7
  deactivatePlugin,
9
8
  getEditedPostContent,
@@ -100,12 +99,7 @@ describe( 'templates', () => {
100
99
  // Remove the default block template to verify that it's not
101
100
  // re-added after saving and reloading the editor.
102
101
  await page.type( '.editor-post-title__input', 'My Image Format' );
103
- await clickBlockAppender();
104
- await page.keyboard.press( 'Backspace' );
105
- // Wait for the selection to update.
106
- await page.evaluate(
107
- () => new Promise( window.requestAnimationFrame )
108
- );
102
+ await page.click( '.wp-block-image' );
109
103
  await page.keyboard.press( 'Backspace' );
110
104
  await saveDraft();
111
105
  await page.reload();
@@ -2,112 +2,126 @@
2
2
 
3
3
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 1`] = `
4
4
  "<!-- wp:paragraph -->
5
- <p>First paragraph</p>
5
+ <p>1st</p>
6
6
  <!-- /wp:paragraph -->
7
7
 
8
8
  <!-- wp:paragraph -->
9
- <p>Second paragraph</p>
9
+ <p>2nd</p>
10
10
  <!-- /wp:paragraph -->
11
11
 
12
12
  <!-- wp:paragraph -->
13
- <p>Third paragraph</p>
13
+ <p>3rd</p>
14
14
  <!-- /wp:paragraph -->"
15
15
  `;
16
16
 
17
17
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 2`] = `
18
18
  "<!-- wp:paragraph -->
19
- <p>Third paragraph</p>
19
+ <p>3rd</p>
20
20
  <!-- /wp:paragraph -->
21
21
 
22
22
  <!-- wp:paragraph -->
23
- <p>First paragraph</p>
23
+ <p>1st</p>
24
24
  <!-- /wp:paragraph -->
25
25
 
26
26
  <!-- wp:paragraph -->
27
- <p>Second paragraph</p>
27
+ <p>2nd</p>
28
28
  <!-- /wp:paragraph -->"
29
29
  `;
30
30
 
31
31
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 1`] = `
32
32
  "<!-- wp:paragraph -->
33
- <p>First paragraph</p>
33
+ <p>1st</p>
34
34
  <!-- /wp:paragraph -->
35
35
 
36
36
  <!-- wp:paragraph -->
37
- <p>Second paragraph</p>
37
+ <p>2nd</p>
38
38
  <!-- /wp:paragraph -->
39
39
 
40
40
  <!-- wp:paragraph -->
41
- <p>Third paragraph</p>
41
+ <p>3rd</p>
42
42
  <!-- /wp:paragraph -->"
43
43
  `;
44
44
 
45
45
  exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 2`] = `
46
46
  "<!-- wp:paragraph -->
47
- <p>Second paragraph</p>
47
+ <p>2nd</p>
48
48
  <!-- /wp:paragraph -->
49
49
 
50
50
  <!-- wp:paragraph -->
51
- <p>Third paragraph</p>
51
+ <p>3rd</p>
52
52
  <!-- /wp:paragraph -->
53
53
 
54
54
  <!-- wp:paragraph -->
55
- <p>First paragraph</p>
55
+ <p>1st</p>
56
56
  <!-- /wp:paragraph -->"
57
57
  `;
58
58
 
59
59
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 1`] = `
60
60
  "<!-- wp:paragraph -->
61
- <p>First paragraph</p>
61
+ <p>1st</p>
62
62
  <!-- /wp:paragraph -->
63
63
 
64
64
  <!-- wp:paragraph -->
65
- <p>Second paragraph</p>
65
+ <p>2nd</p>
66
66
  <!-- /wp:paragraph -->
67
67
 
68
68
  <!-- wp:paragraph -->
69
- <p>Third paragraph</p>
69
+ <p>3rd</p>
70
70
  <!-- /wp:paragraph -->"
71
71
  `;
72
72
 
73
73
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 2`] = `
74
74
  "<!-- wp:paragraph -->
75
- <p>First paragraph</p>
75
+ <p>1st</p>
76
76
  <!-- /wp:paragraph -->
77
77
 
78
78
  <!-- wp:paragraph -->
79
- <p>Third paragraph</p>
79
+ <p>3rd</p>
80
80
  <!-- /wp:paragraph -->
81
81
 
82
82
  <!-- wp:paragraph -->
83
- <p>Second paragraph</p>
83
+ <p>2nd</p>
84
84
  <!-- /wp:paragraph -->"
85
85
  `;
86
86
 
87
87
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 1`] = `
88
88
  "<!-- wp:paragraph -->
89
- <p>First paragraph</p>
89
+ <p>1st</p>
90
90
  <!-- /wp:paragraph -->
91
91
 
92
92
  <!-- wp:paragraph -->
93
- <p>Second paragraph</p>
93
+ <p>2nd</p>
94
94
  <!-- /wp:paragraph -->
95
95
 
96
96
  <!-- wp:paragraph -->
97
- <p>Third paragraph</p>
97
+ <p>3rd</p>
98
98
  <!-- /wp:paragraph -->"
99
99
  `;
100
100
 
101
101
  exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 2`] = `
102
102
  "<!-- wp:paragraph -->
103
- <p>Third paragraph</p>
103
+ <p>3rd</p>
104
104
  <!-- /wp:paragraph -->
105
105
 
106
106
  <!-- wp:paragraph -->
107
- <p>First paragraph</p>
107
+ <p>1st</p>
108
108
  <!-- /wp:paragraph -->
109
109
 
110
110
  <!-- wp:paragraph -->
111
- <p>Second paragraph</p>
111
+ <p>2nd</p>
112
+ <!-- /wp:paragraph -->"
113
+ `;
114
+
115
+ exports[`block editor keyboard shortcuts test shortcuts handling through portals in the same tree should prevent deleting multiple selected blocks from inputs 1`] = `
116
+ "<!-- wp:paragraph -->
117
+ <p>1st</p>
118
+ <!-- /wp:paragraph -->
119
+
120
+ <!-- wp:paragraph -->
121
+ <p>2nd</p>
122
+ <!-- /wp:paragraph -->
123
+
124
+ <!-- wp:paragraph -->
125
+ <p>3rd</p>
112
126
  <!-- /wp:paragraph -->"
113
127
  `;
@@ -89,7 +89,7 @@ exports[`Inserting blocks inserts a block in proper place after having clicked \
89
89
  <!-- /wp:paragraph -->
90
90
 
91
91
  <!-- wp:cover {\\"isDark\\":false} -->
92
- <div class=\\"wp-block-cover is-light\\"><span aria-hidden=\\"true\\" class=\\"has-background-dim-100 wp-block-cover__gradient-background has-background-dim\\"></span><div class=\\"wp-block-cover__inner-container\\"></div></div>
92
+ <div class=\\"wp-block-cover is-light\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-background-dim-100 has-background-dim\\"></span><div class=\\"wp-block-cover__inner-container\\"></div></div>
93
93
  <!-- /wp:cover -->
94
94
 
95
95
  <!-- wp:heading -->
@@ -0,0 +1,35 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Keep styles on block transforms Should keep colors during a transform 1`] = `
4
+ "<!-- wp:paragraph {\\"textColor\\":\\"luminous-vivid-orange\\"} -->
5
+ <p class=\\"has-luminous-vivid-orange-color has-text-color\\">Heading</p>
6
+ <!-- /wp:paragraph -->"
7
+ `;
8
+
9
+ exports[`Keep styles on block transforms Should keep the font size during a transform from multiple blocks into a single one 1`] = `
10
+ "<!-- wp:list {\\"fontSize\\":\\"large\\"} -->
11
+ <ul class=\\"has-large-font-size\\"><li>Line 1 to be made large</li><li>Line 2 to be made large</li><li>Line 3 to be made large</li></ul>
12
+ <!-- /wp:list -->"
13
+ `;
14
+
15
+ exports[`Keep styles on block transforms Should keep the font size during a transform from multiple blocks into multiple blocks 1`] = `
16
+ "<!-- wp:heading {\\"fontSize\\":\\"large\\"} -->
17
+ <h2 class=\\"has-large-font-size\\" id=\\"line-1-to-be-made-large\\">Line 1 to be made large</h2>
18
+ <!-- /wp:heading -->
19
+
20
+ <!-- wp:heading {\\"fontSize\\":\\"large\\"} -->
21
+ <h2 class=\\"has-large-font-size\\" id=\\"line-2-to-be-made-large\\">Line 2 to be made large</h2>
22
+ <!-- /wp:heading -->
23
+
24
+ <!-- wp:heading {\\"fontSize\\":\\"large\\"} -->
25
+ <h2 class=\\"has-large-font-size\\" id=\\"line-3-to-be-made-large\\">Line 3 to be made large</h2>
26
+ <!-- /wp:heading -->"
27
+ `;
28
+
29
+ exports[`Keep styles on block transforms Should not include styles in the group block when grouping a block 1`] = `
30
+ "<!-- wp:group -->
31
+ <div class=\\"wp-block-group\\"><!-- wp:paragraph {\\"fontSize\\":\\"large\\"} -->
32
+ <p class=\\"has-large-font-size\\">Line 1 to be made large</p>
33
+ <!-- /wp:paragraph --></div>
34
+ <!-- /wp:group -->"
35
+ `;
@@ -6,15 +6,18 @@ import {
6
6
  clickBlockAppender,
7
7
  getEditedPostContent,
8
8
  pressKeyWithModifier,
9
+ clickBlockToolbarButton,
10
+ clickMenuItem,
11
+ clickOnCloseModalButton,
9
12
  } from '@wordpress/e2e-test-utils';
10
13
 
11
14
  const createTestParagraphBlocks = async () => {
12
15
  await clickBlockAppender();
13
- await page.keyboard.type( 'First paragraph' );
16
+ await page.keyboard.type( '1st' );
14
17
  await page.keyboard.press( 'Enter' );
15
- await page.keyboard.type( 'Second paragraph' );
18
+ await page.keyboard.type( '2nd' );
16
19
  await page.keyboard.press( 'Enter' );
17
- await page.keyboard.type( 'Third paragraph' );
20
+ await page.keyboard.type( '3rd' );
18
21
  };
19
22
 
20
23
  describe( 'block editor keyboard shortcuts', () => {
@@ -66,4 +69,41 @@ describe( 'block editor keyboard shortcuts', () => {
66
69
  } );
67
70
  } );
68
71
  } );
72
+ describe( 'test shortcuts handling through portals in the same tree', () => {
73
+ beforeEach( async () => {
74
+ await createTestParagraphBlocks();
75
+ // Multiselect via keyboard.
76
+ await pressKeyWithModifier( 'primary', 'a' );
77
+ await pressKeyWithModifier( 'primary', 'a' );
78
+ } );
79
+ it( 'should propagate properly and delete selected blocks', async () => {
80
+ await clickBlockToolbarButton( 'Options' );
81
+ const label = 'Duplicate';
82
+ await page.$x(
83
+ `//div[@role="menu"]//span[contains(concat(" ", @class, " "), " components-menu-item__item ")][contains(text(), "${ label }")]`
84
+ );
85
+ await page.keyboard.press( 'Delete' );
86
+ expect( await getEditedPostContent() ).toMatchInlineSnapshot(
87
+ `""`
88
+ );
89
+ } );
90
+ it( 'should prevent deleting multiple selected blocks from inputs', async () => {
91
+ await clickBlockToolbarButton( 'Options' );
92
+ await clickMenuItem( 'Add to Reusable blocks' );
93
+ const reusableBlockNameInputSelector =
94
+ '.reusable-blocks-menu-items__convert-modal .components-text-control__input';
95
+ const nameInput = await page.waitForSelector(
96
+ reusableBlockNameInputSelector
97
+ );
98
+ await nameInput.click();
99
+ await page.keyboard.type( 'hi' );
100
+ await page.keyboard.press( 'Backspace' );
101
+ await page.keyboard.press( 'ArrowLeft' );
102
+ await page.keyboard.press( 'Delete' );
103
+ await clickOnCloseModalButton(
104
+ '.reusable-blocks-menu-items__convert-modal'
105
+ );
106
+ expect( await getEditedPostContent() ).toMatchSnapshot();
107
+ } );
108
+ } );
69
109
  } );
@@ -7,7 +7,6 @@ import {
7
7
  createNewPost,
8
8
  pressKeyWithModifier,
9
9
  pressKeyTimes,
10
- activateTheme,
11
10
  openTypographyToolsPanelMenu,
12
11
  } from '@wordpress/e2e-test-utils';
13
12
 
@@ -100,21 +99,68 @@ describe( 'Font Size Picker', () => {
100
99
  ` );
101
100
  } );
102
101
  } );
102
+
103
103
  // A different control is rendered based on the available font sizes number.
104
104
  describe( 'More font sizes', () => {
105
- beforeAll( async () => {
106
- await activateTheme( 'tt1-blocks' );
107
- } );
108
- afterAll( async () => {
109
- await activateTheme( 'twentytwentyone' );
105
+ beforeEach( async () => {
106
+ await page.evaluate( () => {
107
+ wp.data.dispatch( 'core/block-editor' ).updateSettings(
108
+ // eslint-disable-next-line no-undef
109
+ lodash.merge(
110
+ wp.data.select( 'core/block-editor' ).getSettings(),
111
+ {
112
+ __experimentalFeatures: {
113
+ typography: {
114
+ fontSizes: {
115
+ default: [
116
+ {
117
+ name: 'Tiny',
118
+ slug: 'tiny',
119
+ size: '11px',
120
+ },
121
+ ,
122
+ {
123
+ name: 'Small',
124
+ slug: 'small',
125
+ size: '13px',
126
+ },
127
+ {
128
+ name: 'Medium',
129
+ slug: 'medium',
130
+ size: '20px',
131
+ },
132
+ {
133
+ name: 'Large',
134
+ slug: 'large',
135
+ size: '36px',
136
+ },
137
+ {
138
+ name: 'Extra Large',
139
+ slug: 'x-large',
140
+ size: '42px',
141
+ },
142
+ {
143
+ name: 'Huge',
144
+ slug: 'huge',
145
+ size: '48px',
146
+ },
147
+ ],
148
+ },
149
+ },
150
+ },
151
+ }
152
+ )
153
+ );
154
+ } );
110
155
  } );
156
+
111
157
  it( 'should apply a named font size using the font size buttons', async () => {
112
158
  // Create a paragraph block with some content.
113
159
  await clickBlockAppender();
114
160
  await page.keyboard.type( 'Paragraph to be made "large"' );
115
161
 
116
162
  await openFontSizeSelectControl();
117
- await pressKeyTimes( 'ArrowDown', 4 );
163
+ await pressKeyTimes( 'ArrowDown', 5 );
118
164
  await page.keyboard.press( 'Enter' );
119
165
 
120
166
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
@@ -131,11 +177,11 @@ describe( 'Font Size Picker', () => {
131
177
  );
132
178
 
133
179
  await openFontSizeSelectControl();
134
- await pressKeyTimes( 'ArrowDown', 3 );
180
+ await pressKeyTimes( 'ArrowDown', 4 );
135
181
  await page.keyboard.press( 'Enter' );
136
182
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
137
- "<!-- wp:paragraph {\\"fontSize\\":\\"normal\\"} -->
138
- <p class=\\"has-normal-font-size\\">Paragraph with font size reset using tools panel menu</p>
183
+ "<!-- wp:paragraph {\\"fontSize\\":\\"medium\\"} -->
184
+ <p class=\\"has-medium-font-size\\">Paragraph with font size reset using tools panel menu</p>
139
185
  <!-- /wp:paragraph -->"
140
186
  ` );
141
187
 
@@ -158,7 +204,7 @@ describe( 'Font Size Picker', () => {
158
204
  );
159
205
 
160
206
  await openFontSizeSelectControl();
161
- await pressKeyTimes( 'ArrowDown', 2 );
207
+ await pressKeyTimes( 'ArrowDown', 3 );
162
208
  await page.keyboard.press( 'Enter' );
163
209
  expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
164
210
  "<!-- wp:paragraph {\\"fontSize\\":\\"small\\"} -->
@@ -14,7 +14,7 @@ describe( 'Fullscreen Mode', () => {
14
14
 
15
15
  it( 'should open the fullscreen mode from the more menu', async () => {
16
16
  await clickOnMoreMenuItem( 'Fullscreen mode' );
17
- await toggleMoreMenu();
17
+ await toggleMoreMenu( 'close' );
18
18
 
19
19
  const isFullscreenEnabled = await page.$eval( 'body', ( body ) => {
20
20
  return body.classList.contains( 'is-fullscreen-mode' );
@@ -0,0 +1,81 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ clickBlockAppender,
6
+ createNewPost,
7
+ getEditedPostContent,
8
+ pressKeyWithModifier,
9
+ transformBlockTo,
10
+ } from '@wordpress/e2e-test-utils';
11
+
12
+ describe( 'Keep styles on block transforms', () => {
13
+ beforeEach( async () => {
14
+ await createNewPost();
15
+ } );
16
+
17
+ it( 'Should keep colors during a transform', async () => {
18
+ await clickBlockAppender();
19
+ await page.keyboard.type( '## Heading' );
20
+
21
+ const textColorButton = await page.waitForSelector(
22
+ '.block-editor-panel-color-gradient-settings__dropdown'
23
+ );
24
+ await textColorButton.click();
25
+
26
+ const colorButtonSelector = `//button[@aria-label='Color: Luminous vivid orange']`;
27
+ const [ colorButton ] = await page.$x( colorButtonSelector );
28
+ await colorButton.click();
29
+ await page.waitForXPath(
30
+ `${ colorButtonSelector }[@aria-pressed='true']`
31
+ );
32
+ await page.click( 'h2[data-type="core/heading"]' );
33
+ await transformBlockTo( 'Paragraph' );
34
+ expect( await getEditedPostContent() ).toMatchSnapshot();
35
+ } );
36
+
37
+ it( 'Should keep the font size during a transform from multiple blocks into a single one', async () => {
38
+ // Create a paragraph block with some content.
39
+ await clickBlockAppender();
40
+ await page.keyboard.type( 'Line 1 to be made large' );
41
+ await page.keyboard.press( 'Enter' );
42
+ await page.keyboard.type( 'Line 2 to be made large' );
43
+ await page.keyboard.press( 'Enter' );
44
+ await page.keyboard.type( 'Line 3 to be made large' );
45
+ await pressKeyWithModifier( 'shift', 'ArrowUp' );
46
+ await pressKeyWithModifier( 'shift', 'ArrowUp' );
47
+ await page.click(
48
+ '[role="radiogroup"][aria-label="Font size"] [aria-label="Large"]'
49
+ );
50
+ await transformBlockTo( 'List' );
51
+ expect( await getEditedPostContent() ).toMatchSnapshot();
52
+ } );
53
+
54
+ it( 'Should keep the font size during a transform from multiple blocks into multiple blocks', async () => {
55
+ // Create a paragraph block with some content.
56
+ await clickBlockAppender();
57
+ await page.keyboard.type( 'Line 1 to be made large' );
58
+ await page.keyboard.press( 'Enter' );
59
+ await page.keyboard.type( 'Line 2 to be made large' );
60
+ await page.keyboard.press( 'Enter' );
61
+ await page.keyboard.type( 'Line 3 to be made large' );
62
+ await pressKeyWithModifier( 'shift', 'ArrowUp' );
63
+ await pressKeyWithModifier( 'shift', 'ArrowUp' );
64
+ await page.click(
65
+ '[role="radiogroup"][aria-label="Font size"] [aria-label="Large"]'
66
+ );
67
+ await transformBlockTo( 'Heading' );
68
+ expect( await getEditedPostContent() ).toMatchSnapshot();
69
+ } );
70
+
71
+ it( 'Should not include styles in the group block when grouping a block', async () => {
72
+ // Create a paragraph block with some content.
73
+ await clickBlockAppender();
74
+ await page.keyboard.type( 'Line 1 to be made large' );
75
+ await page.click(
76
+ '[role="radiogroup"][aria-label="Font size"] [aria-label="Large"]'
77
+ );
78
+ await transformBlockTo( 'Group' );
79
+ expect( await getEditedPostContent() ).toMatchSnapshot();
80
+ } );
81
+ } );
@@ -102,7 +102,7 @@ describe( 'Post Editor Template mode', () => {
102
102
  } );
103
103
 
104
104
  it( 'Allow to switch to template mode, edit the template and check the result', async () => {
105
- await activateTheme( 'tt1-blocks' );
105
+ await activateTheme( 'emptytheme' );
106
106
  await createNewPost();
107
107
  // Create a random post.
108
108
  await page.type( '.editor-post-title__input', 'Just an FSE Post' );