@wordpress/e2e-tests 7.19.0 → 7.20.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 (50) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/jest.config.js +0 -1
  4. package/package.json +8 -9
  5. package/plugins/iframed-block/block.json +1 -0
  6. package/plugins/iframed-inline-styles/block.json +1 -0
  7. package/plugins/iframed-masonry-block/block.json +1 -0
  8. package/plugins/iframed-multiple-stylesheets/block.json +1 -0
  9. package/plugins/interactive-blocks/directive-bind/block.json +1 -0
  10. package/plugins/interactive-blocks/directive-body/block.json +1 -0
  11. package/plugins/interactive-blocks/directive-class/block.json +1 -0
  12. package/plugins/interactive-blocks/directive-context/block.json +1 -0
  13. package/plugins/interactive-blocks/directive-init/block.json +1 -0
  14. package/plugins/interactive-blocks/directive-key/block.json +1 -0
  15. package/plugins/interactive-blocks/directive-on/block.json +1 -0
  16. package/plugins/interactive-blocks/directive-priorities/block.json +1 -0
  17. package/plugins/interactive-blocks/directive-slots/block.json +1 -0
  18. package/plugins/interactive-blocks/directive-style/block.json +1 -0
  19. package/plugins/interactive-blocks/directive-text/block.json +1 -0
  20. package/plugins/interactive-blocks/directive-watch/block.json +1 -0
  21. package/plugins/interactive-blocks/negation-operator/block.json +1 -0
  22. package/plugins/interactive-blocks/router-navigate/block.json +1 -0
  23. package/plugins/interactive-blocks/router-regions/block.json +1 -0
  24. package/plugins/interactive-blocks/store-tag/block.json +1 -0
  25. package/plugins/interactive-blocks/tovdom/block.json +1 -0
  26. package/plugins/interactive-blocks/tovdom-islands/block.json +1 -0
  27. package/plugins/interactive-blocks/tovdom-islands/render.php +12 -0
  28. package/plugins/pattern-recursion.php +22 -0
  29. package/specs/editor/various/inserting-blocks.test.js +3 -5
  30. package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +0 -153
  31. package/specs/editor/various/allowed-patterns.test.js +0 -74
  32. package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +0 -110
  33. package/specs/editor/various/block-switcher.test.js +0 -130
  34. package/specs/editor/various/core-settings.test.js +0 -42
  35. package/specs/editor/various/datepicker.test.js +0 -148
  36. package/specs/editor/various/dropdown-menu.test.js +0 -143
  37. package/specs/editor/various/editor-modes.test.js +0 -163
  38. package/specs/editor/various/invalid-block.test.js +0 -100
  39. package/specs/editor/various/nux.test.js +0 -158
  40. package/specs/editor/various/preferences.test.js +0 -62
  41. package/specs/editor/various/publish-panel.test.js +0 -82
  42. package/specs/editor/various/publishing.test.js +0 -176
  43. package/specs/editor/various/scheduling.test.js +0 -65
  44. package/specs/editor/various/sidebar.test.js +0 -171
  45. package/specs/editor/various/taxonomies.test.js +0 -251
  46. package/specs/experiments/blocks/post-comments-form.test.js +0 -53
  47. package/specs/experiments/experimental-features.js +0 -39
  48. package/specs/experiments/fixtures/menu-items-request-fixture.json +0 -84
  49. package/specs/site-editor/settings-sidebar.test.js +0 -122
  50. package/specs/widgets/editing-widgets.test.js +0 -962
package/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.20.0 (2024-01-10)
6
+
5
7
  ## 7.19.0 (2023-12-13)
6
8
 
7
9
  ## 7.18.0 (2023-11-29)
package/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Gutenberg
2
2
 
3
- Copyright 2016-2023 by the contributors
3
+ Copyright 2016-2024 by the contributors
4
4
 
5
5
  **License for Contributions (on and after April 15, 2021)**
6
6
 
package/jest.config.js CHANGED
@@ -12,7 +12,6 @@ module.exports = {
12
12
  '@wordpress/jest-console',
13
13
  '@wordpress/jest-puppeteer-axe',
14
14
  'expect-puppeteer',
15
- 'puppeteer-testing-library/extend-expect',
16
15
  ],
17
16
  testPathIgnorePatterns: [ '/node_modules/' ],
18
17
  snapshotFormat: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/e2e-tests",
3
- "version": "7.19.0",
3
+ "version": "7.20.0",
4
4
  "description": "End-To-End (E2E) tests for WordPress.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -23,18 +23,17 @@
23
23
  "node": ">=14"
24
24
  },
25
25
  "dependencies": {
26
- "@wordpress/e2e-test-utils": "^10.19.0",
27
- "@wordpress/interactivity": "^3.1.0",
28
- "@wordpress/jest-console": "^7.19.0",
29
- "@wordpress/jest-puppeteer-axe": "^6.19.0",
30
- "@wordpress/scripts": "^26.19.0",
31
- "@wordpress/url": "^3.49.0",
26
+ "@wordpress/e2e-test-utils": "^10.20.0",
27
+ "@wordpress/interactivity": "^3.2.0",
28
+ "@wordpress/jest-console": "^7.20.0",
29
+ "@wordpress/jest-puppeteer-axe": "^6.20.0",
30
+ "@wordpress/scripts": "^27.0.0",
31
+ "@wordpress/url": "^3.50.0",
32
32
  "chalk": "^4.0.0",
33
33
  "expect-puppeteer": "^4.4.0",
34
34
  "filenamify": "^4.2.0",
35
35
  "jest-message-util": "^29.6.2",
36
36
  "jest-snapshot": "^29.6.2",
37
- "puppeteer-testing-library": "^0.5.0",
38
37
  "uuid": "^9.0.1"
39
38
  },
40
39
  "peerDependencies": {
@@ -46,5 +45,5 @@
46
45
  "publishConfig": {
47
46
  "access": "public"
48
47
  },
49
- "gitHead": "fcf61b4beff747222c2c81d09d757ca1a0abd925"
48
+ "gitHead": "5e6f9caa205d3bfdbac131952b7bf9c6ec60569b"
50
49
  }
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-block",
4
5
  "title": "Iframed Block",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-inline-styles",
4
5
  "title": "Iframed Inline Styles",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-masonry-block",
4
5
  "title": "Iframed Masonry Block",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 3,
3
4
  "name": "test/iframed-multiple-stylesheets",
4
5
  "title": "Iframed Multiple Stylesheets",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-bind",
4
5
  "title": "E2E Interactivity tests - directive bind",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-body",
4
5
  "title": "E2E Interactivity tests - directive body",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-class",
4
5
  "title": "E2E Interactivity tests - directive class",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-context",
4
5
  "title": "E2E Interactivity tests - directive context",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-init",
4
5
  "title": "E2E Interactivity tests - directive init",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-key",
4
5
  "title": "E2E Interactivity tests - directive key",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-on",
4
5
  "title": "E2E Interactivity tests - directive on",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-priorities",
4
5
  "title": "E2E Interactivity tests - directive priorities",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-slots",
4
5
  "title": "E2E Interactivity tests - directive slots",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-style",
4
5
  "title": "E2E Interactivity tests - directive style",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-text",
4
5
  "title": "E2E Interactivity tests - directive text",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/directive-watch",
4
5
  "title": "E2E Interactivity tests - directive watch",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/negation-operator",
4
5
  "title": "E2E Interactivity tests - negation operator",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/router-navigate",
4
5
  "title": "E2E Interactivity tests - router navigate",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/router-regions",
4
5
  "title": "E2E Interactivity tests - router regions",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/store-tag",
4
5
  "title": "E2E Interactivity tests - store tag",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/tovdom",
4
5
  "title": "E2E Interactivity tests - tovdom",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "$schema": "https://schemas.wp.org/trunk/block.json",
2
3
  "apiVersion": 2,
3
4
  "name": "test/tovdom-islands",
4
5
  "title": "E2E Interactivity tests - tovdom islands",
@@ -68,4 +68,16 @@ gutenberg_enqueue_module( 'tovdom-islands-view' );
68
68
  </div>
69
69
  </div>
70
70
  </div>
71
+
72
+
73
+
74
+ <div data-wp-interactive='{ "namespace": "tovdom-islands" }'>
75
+ <div data-wp-interactive='{ "namespace": "something-new" }'></div>
76
+ <div data-wp-show-mock="state.falseValue">
77
+ <span data-testid="directive after different namespace">
78
+ The directive above should keep the `tovdom-island` namespace,
79
+ so this message should not be visible.
80
+ </span>
81
+ </div>
82
+ </div>
71
83
  </div>
@@ -0,0 +1,22 @@
1
+ <?php
2
+ /**
3
+ * Plugin Name: Gutenberg Test Protection Against Recursive Patterns
4
+ * Plugin URI: https://github.com/WordPress/gutenberg
5
+ * Author: Gutenberg Team
6
+ *
7
+ * @package gutenberg-test-pattern-recursion
8
+ */
9
+
10
+ add_filter(
11
+ 'init',
12
+ function () {
13
+ register_block_pattern(
14
+ 'evil/recursive',
15
+ array(
16
+ 'title' => 'Evil recursive',
17
+ 'description' => 'Evil recursive',
18
+ 'content' => '<!-- wp:paragraph --><p>Hello</p><!-- /wp:paragraph --><!-- wp:pattern {"slug":"evil/recursive"} /-->',
19
+ )
20
+ );
21
+ }
22
+ );
@@ -323,7 +323,7 @@ describe( 'Inserting blocks', () => {
323
323
  );
324
324
  await browseAll.click();
325
325
  const availableBlocks = await page.$$(
326
- '.edit-post-editor__inserter-panel .block-editor-block-types-list__list-item'
326
+ '.editor-inserter-sidebar .block-editor-block-types-list__list-item'
327
327
  );
328
328
  expect( availableBlocks ).toHaveLength( 1 );
329
329
  } );
@@ -332,13 +332,11 @@ describe( 'Inserting blocks', () => {
332
332
  it( 'closes the main inserter after inserting a single-use block, like the More block', async () => {
333
333
  await insertBlock( 'More' );
334
334
  await page.waitForSelector(
335
- '.edit-post-header-toolbar__inserter-toggle:not(.is-pressed)'
335
+ '.editor-document-tools__inserter-toggle:not(.is-pressed)'
336
336
  );
337
337
 
338
338
  // The inserter panel should've closed.
339
- const inserterPanels = await page.$$(
340
- '.edit-post-editor__inserter-panel'
341
- );
339
+ const inserterPanels = await page.$$( '.editor-inserter-sidebar' );
342
340
  expect( inserterPanels.length ).toBe( 0 );
343
341
 
344
342
  // The editable 'Read More' text should be focused.
@@ -1,153 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 1`] = `
4
- "<!-- wp:paragraph -->
5
- <p>1st</p>
6
- <!-- /wp:paragraph -->
7
-
8
- <!-- wp:paragraph -->
9
- <p>2nd</p>
10
- <!-- /wp:paragraph -->
11
-
12
- <!-- wp:paragraph -->
13
- <p>3rd</p>
14
- <!-- /wp:paragraph -->"
15
- `;
16
-
17
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks down 2`] = `
18
- "<!-- wp:paragraph -->
19
- <p>3rd</p>
20
- <!-- /wp:paragraph -->
21
-
22
- <!-- wp:paragraph -->
23
- <p>1st</p>
24
- <!-- /wp:paragraph -->
25
-
26
- <!-- wp:paragraph -->
27
- <p>2nd</p>
28
- <!-- /wp:paragraph -->"
29
- `;
30
-
31
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 1`] = `
32
- "<!-- wp:paragraph -->
33
- <p>1st</p>
34
- <!-- /wp:paragraph -->
35
-
36
- <!-- wp:paragraph -->
37
- <p>2nd</p>
38
- <!-- /wp:paragraph -->
39
-
40
- <!-- wp:paragraph -->
41
- <p>3rd</p>
42
- <!-- /wp:paragraph -->"
43
- `;
44
-
45
- exports[`block editor keyboard shortcuts move blocks multiple blocks selected should move the blocks up 2`] = `
46
- "<!-- wp:paragraph -->
47
- <p>2nd</p>
48
- <!-- /wp:paragraph -->
49
-
50
- <!-- wp:paragraph -->
51
- <p>3rd</p>
52
- <!-- /wp:paragraph -->
53
-
54
- <!-- wp:paragraph -->
55
- <p>1st</p>
56
- <!-- /wp:paragraph -->"
57
- `;
58
-
59
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 1`] = `
60
- "<!-- wp:paragraph -->
61
- <p>1st</p>
62
- <!-- /wp:paragraph -->
63
-
64
- <!-- wp:paragraph -->
65
- <p>2nd</p>
66
- <!-- /wp:paragraph -->
67
-
68
- <!-- wp:paragraph -->
69
- <p>3rd</p>
70
- <!-- /wp:paragraph -->"
71
- `;
72
-
73
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block down 2`] = `
74
- "<!-- wp:paragraph -->
75
- <p>1st</p>
76
- <!-- /wp:paragraph -->
77
-
78
- <!-- wp:paragraph -->
79
- <p>3rd</p>
80
- <!-- /wp:paragraph -->
81
-
82
- <!-- wp:paragraph -->
83
- <p>2nd</p>
84
- <!-- /wp:paragraph -->"
85
- `;
86
-
87
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 1`] = `
88
- "<!-- wp:paragraph -->
89
- <p>1st</p>
90
- <!-- /wp:paragraph -->
91
-
92
- <!-- wp:paragraph -->
93
- <p>2nd</p>
94
- <!-- /wp:paragraph -->
95
-
96
- <!-- wp:paragraph -->
97
- <p>3rd</p>
98
- <!-- /wp:paragraph -->"
99
- `;
100
-
101
- exports[`block editor keyboard shortcuts move blocks single block selected should move the block up 2`] = `
102
- "<!-- wp:paragraph -->
103
- <p>3rd</p>
104
- <!-- /wp:paragraph -->
105
-
106
- <!-- wp:paragraph -->
107
- <p>1st</p>
108
- <!-- /wp:paragraph -->
109
-
110
- <!-- wp:paragraph -->
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>
126
- <!-- /wp:paragraph -->"
127
- `;
128
-
129
- exports[`block editor keyboard shortcuts test shortcuts handling through portals in the same tree should propagate properly and duplicate selected blocks 1`] = `
130
- "<!-- wp:paragraph -->
131
- <p>1st</p>
132
- <!-- /wp:paragraph -->
133
-
134
- <!-- wp:paragraph -->
135
- <p>2nd</p>
136
- <!-- /wp:paragraph -->
137
-
138
- <!-- wp:paragraph -->
139
- <p>3rd</p>
140
- <!-- /wp:paragraph -->
141
-
142
- <!-- wp:paragraph -->
143
- <p>1st</p>
144
- <!-- /wp:paragraph -->
145
-
146
- <!-- wp:paragraph -->
147
- <p>2nd</p>
148
- <!-- /wp:paragraph -->
149
-
150
- <!-- wp:paragraph -->
151
- <p>3rd</p>
152
- <!-- /wp:paragraph -->"
153
- `;
@@ -1,74 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- activatePlugin,
6
- createNewPost,
7
- deactivatePlugin,
8
- searchForPattern,
9
- toggleGlobalBlockInserter,
10
- } from '@wordpress/e2e-test-utils';
11
-
12
- const checkPatternExistence = async ( name, available = true ) => {
13
- await searchForPattern( name );
14
- const patternElement = await page.waitForXPath(
15
- `//div[@role = 'option']//div[contains(text(), '${ name }')]`,
16
- { timeout: 5000, visible: available, hidden: ! available }
17
- );
18
- const patternExists = !! patternElement;
19
- await toggleGlobalBlockInserter();
20
- return patternExists;
21
- };
22
-
23
- const TEST_PATTERNS = [
24
- [ 'Test: Single heading', true ],
25
- [ 'Test: Single paragraph', false ],
26
- [ 'Test: Paragraph inside group', false ],
27
- ];
28
-
29
- describe( 'Allowed Patterns', () => {
30
- beforeAll( async () => {
31
- await activatePlugin( 'gutenberg-test-allowed-patterns' );
32
- await createNewPost();
33
- } );
34
- afterAll( async () => {
35
- await deactivatePlugin( 'gutenberg-test-allowed-patterns' );
36
- } );
37
-
38
- describe( 'Disable blocks plugin disabled', () => {
39
- for ( const [ patternName ] of TEST_PATTERNS ) {
40
- it( `should show test pattern "${ patternName }"`, async () => {
41
- expect( await checkPatternExistence( patternName, true ) ).toBe(
42
- true
43
- );
44
- } );
45
- }
46
- } );
47
-
48
- describe( 'Disable blocks plugin enabled', () => {
49
- beforeAll( async () => {
50
- await activatePlugin(
51
- 'gutenberg-test-allowed-patterns-disable-blocks'
52
- );
53
- await createNewPost();
54
- } );
55
- afterAll( async () => {
56
- await deactivatePlugin(
57
- 'gutenberg-test-allowed-patterns-disable-blocks'
58
- );
59
- } );
60
-
61
- for ( const [ patternName, shouldBeAvailable ] of TEST_PATTERNS ) {
62
- it( `should${
63
- shouldBeAvailable ? '' : ' not'
64
- } show test "pattern ${ patternName }"`, async () => {
65
- expect(
66
- await checkPatternExistence(
67
- patternName,
68
- shouldBeAvailable
69
- )
70
- ).toBe( shouldBeAvailable );
71
- } );
72
- }
73
- } );
74
- } );
@@ -1,110 +0,0 @@
1
- /**
2
- * WordPress dependencies
3
- */
4
- import {
5
- createNewPost,
6
- clickBlockAppender,
7
- getEditedPostContent,
8
- pressKeyWithModifier,
9
- clickBlockToolbarButton,
10
- clickMenuItem,
11
- clickOnCloseModalButton,
12
- canvas,
13
- } from '@wordpress/e2e-test-utils';
14
-
15
- const createTestParagraphBlocks = async () => {
16
- await clickBlockAppender();
17
- await page.keyboard.type( '1st' );
18
- await page.keyboard.press( 'Enter' );
19
- await page.keyboard.type( '2nd' );
20
- await page.keyboard.press( 'Enter' );
21
- await page.keyboard.type( '3rd' );
22
- };
23
-
24
- describe( 'block editor keyboard shortcuts', () => {
25
- beforeEach( async () => {
26
- await createNewPost();
27
- } );
28
-
29
- describe( 'move blocks', () => {
30
- const moveUp = async () => pressKeyWithModifier( 'secondary', 't' );
31
- const moveDown = async () => pressKeyWithModifier( 'secondary', 'y' );
32
- describe( 'single block selected', () => {
33
- it( 'should move the block up', async () => {
34
- await createTestParagraphBlocks();
35
- expect( await getEditedPostContent() ).toMatchSnapshot();
36
- await moveUp();
37
- await moveUp();
38
- expect( await getEditedPostContent() ).toMatchSnapshot();
39
- } );
40
-
41
- it( 'should move the block down', async () => {
42
- await createTestParagraphBlocks();
43
- expect( await getEditedPostContent() ).toMatchSnapshot();
44
- await page.keyboard.press( 'ArrowUp' );
45
- await moveDown();
46
- expect( await getEditedPostContent() ).toMatchSnapshot();
47
- } );
48
- } );
49
-
50
- describe( 'multiple blocks selected', () => {
51
- it( 'should move the blocks up', async () => {
52
- await createTestParagraphBlocks();
53
- expect( await getEditedPostContent() ).toMatchSnapshot();
54
- await pressKeyWithModifier( 'shift', 'ArrowUp' );
55
- await canvas().waitForSelector(
56
- '[aria-label="Multiple selected blocks"]'
57
- );
58
- await moveUp();
59
- expect( await getEditedPostContent() ).toMatchSnapshot();
60
- } );
61
-
62
- it( 'should move the blocks down', async () => {
63
- await createTestParagraphBlocks();
64
- expect( await getEditedPostContent() ).toMatchSnapshot();
65
- await page.keyboard.press( 'ArrowUp' );
66
- await pressKeyWithModifier( 'shift', 'ArrowUp' );
67
- await canvas().waitForSelector(
68
- '[aria-label="Multiple selected blocks"]'
69
- );
70
- await moveDown();
71
- expect( await getEditedPostContent() ).toMatchSnapshot();
72
- } );
73
- } );
74
- } );
75
- describe( 'test shortcuts handling through portals in the same tree', () => {
76
- beforeEach( async () => {
77
- await createTestParagraphBlocks();
78
- // Multiselect via keyboard.
79
- await pressKeyWithModifier( 'primary', 'a' );
80
- await pressKeyWithModifier( 'primary', 'a' );
81
- } );
82
- it( 'should propagate properly and duplicate selected blocks', async () => {
83
- await clickBlockToolbarButton( 'Options' );
84
- const label = 'Duplicate';
85
- await page.$x(
86
- `//div[@role="menu"]//span[contains(concat(" ", @class, " "), " components-menu-item__item ")][contains(text(), "${ label }")]`
87
- );
88
- await pressKeyWithModifier( 'primaryShift', 'd' );
89
- expect( await getEditedPostContent() ).toMatchSnapshot();
90
- } );
91
- it( 'should prevent deleting multiple selected blocks from inputs', async () => {
92
- await clickBlockToolbarButton( 'Options' );
93
- await clickMenuItem( 'Create pattern' );
94
- const reusableBlockNameInputSelector =
95
- '.patterns-menu-items__convert-modal .components-text-control__input';
96
- const nameInput = await page.waitForSelector(
97
- reusableBlockNameInputSelector
98
- );
99
- await nameInput.click();
100
- await page.keyboard.type( 'hi' );
101
- await page.keyboard.press( 'Backspace' );
102
- await page.keyboard.press( 'ArrowLeft' );
103
- await page.keyboard.press( 'Delete' );
104
- await clickOnCloseModalButton(
105
- '.patterns-menu-items__convert-modal'
106
- );
107
- expect( await getEditedPostContent() ).toMatchSnapshot();
108
- } );
109
- } );
110
- } );