@wordpress/e2e-tests 2.5.14 → 3.0.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/CHANGELOG.md +7 -0
- package/LICENSE.md +1 -1
- package/config/flaky-tests-reporter.js +2 -1
- package/package.json +12 -11
- package/plugins/query-block.php +2 -2
- package/specs/editor/blocks/__snapshots__/heading.test.js.snap +2 -2
- package/specs/editor/blocks/__snapshots__/navigation.test.js.snap +29 -57
- package/specs/editor/blocks/__snapshots__/spacer.test.js.snap +1 -1
- package/specs/editor/blocks/classic.test.js +5 -2
- package/specs/editor/blocks/columns.test.js +1 -1
- package/specs/editor/blocks/cover.test.js +1 -1
- package/specs/editor/blocks/heading.test.js +15 -3
- package/specs/editor/blocks/image.test.js +1 -2
- package/specs/editor/blocks/navigation.test.js +311 -439
- package/specs/editor/blocks/preformatted.test.js +2 -1
- package/specs/editor/blocks/site-title.test.js +2 -31
- package/specs/editor/fixtures/menu-items-request-fixture.json +84 -0
- package/specs/editor/fixtures/menu-items-response-fixture.json +240 -144
- package/specs/editor/plugins/block-variations.test.js +1 -1
- package/specs/editor/plugins/custom-post-types.test.js +4 -3
- package/specs/editor/plugins/iframed-inline-styles.test.js +0 -6
- package/specs/editor/plugins/iframed-multiple-block-stylesheets.test.js +0 -4
- package/specs/editor/various/__snapshots__/block-editor-keyboard-shortcuts.test.js.snap +38 -24
- package/specs/editor/various/adding-patterns.test.js +1 -1
- package/specs/editor/various/block-editor-keyboard-shortcuts.test.js +43 -3
- package/specs/editor/various/block-grouping.test.js +2 -18
- package/specs/editor/various/block-hierarchy-navigation.test.js +3 -3
- package/specs/editor/various/change-detection.test.js +5 -0
- package/specs/editor/various/editor-modes.test.js +7 -0
- package/specs/editor/various/font-size-picker.test.js +58 -18
- package/specs/editor/various/inserting-blocks.test.js +6 -2
- package/specs/editor/various/keyboard-navigable-blocks.test.js +6 -0
- package/specs/editor/various/list-view.test.js +2 -2
- package/specs/editor/various/navigable-toolbar.test.js +2 -2
- package/specs/editor/various/post-editor-template-mode.test.js +1 -1
- package/specs/editor/various/preview.test.js +67 -2
- package/specs/editor/various/reusable-blocks.test.js +53 -31
- package/specs/editor/various/undo.test.js +21 -0
- package/specs/editor/various/writing-flow.test.js +8 -4
- package/specs/performance/site-editor.test.js +1 -1
- package/specs/site-editor/document-settings.test.js +5 -5
- package/specs/site-editor/multi-entity-editing.test.js +2 -2
- package/specs/site-editor/multi-entity-saving.test.js +95 -57
- package/specs/site-editor/settings-sidebar.test.js +4 -4
- package/specs/site-editor/site-editor-export.test.js +1 -1
- package/specs/site-editor/site-editor-inserter.test.js +1 -1
- package/specs/site-editor/template-part.test.js +95 -79
- package/specs/site-editor/template-revert.test.js +13 -9
- package/specs/widgets/customizing-widgets.test.js +7 -23
- package/specs/widgets/editing-widgets.test.js +36 -12
@@ -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
|
} );
|
@@ -7,6 +7,7 @@ import {
|
|
7
7
|
deactivatePlugin,
|
8
8
|
publishPost,
|
9
9
|
findSidebarPanelWithTitle,
|
10
|
+
clickBlockAppender,
|
10
11
|
} from '@wordpress/e2e-test-utils';
|
11
12
|
|
12
13
|
const openPageAttributesPanel = async () => {
|
@@ -40,7 +41,7 @@ describe( 'Test Custom Post Types', () => {
|
|
40
41
|
|
41
42
|
// Create a parent post.
|
42
43
|
await createNewPost( { postType: 'hierar-no-title' } );
|
43
|
-
await
|
44
|
+
await clickBlockAppender();
|
44
45
|
await page.keyboard.type( 'Parent Post' );
|
45
46
|
await publishPost();
|
46
47
|
// Create a post that is a child of the previously created post.
|
@@ -55,7 +56,7 @@ describe( 'Test Custom Post Types', () => {
|
|
55
56
|
( element ) => element.textContent
|
56
57
|
);
|
57
58
|
await optionToSelect.click();
|
58
|
-
await
|
59
|
+
await clickBlockAppender();
|
59
60
|
await page.keyboard.type( 'Child Post' );
|
60
61
|
await publishPost();
|
61
62
|
// Reload the child post and verify it is still correctly selected as a child post.
|
@@ -72,7 +73,7 @@ describe( 'Test Custom Post Types', () => {
|
|
72
73
|
} );
|
73
74
|
it( 'should create a cpt with a legacy block in its template without WSOD', async () => {
|
74
75
|
await createNewPost( { postType: 'leg_block_in_tpl' } );
|
75
|
-
await
|
76
|
+
await clickBlockAppender();
|
76
77
|
await page.keyboard.type( 'Hello there' );
|
77
78
|
await page.waitForSelector( '[data-type="core/embed"]' );
|
78
79
|
await publishPost();
|
@@ -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
|
} );
|
@@ -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>
|
5
|
+
<p>1st</p>
|
6
6
|
<!-- /wp:paragraph -->
|
7
7
|
|
8
8
|
<!-- wp:paragraph -->
|
9
|
-
<p>
|
9
|
+
<p>2nd</p>
|
10
10
|
<!-- /wp:paragraph -->
|
11
11
|
|
12
12
|
<!-- wp:paragraph -->
|
13
|
-
<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>
|
19
|
+
<p>3rd</p>
|
20
20
|
<!-- /wp:paragraph -->
|
21
21
|
|
22
22
|
<!-- wp:paragraph -->
|
23
|
-
<p>
|
23
|
+
<p>1st</p>
|
24
24
|
<!-- /wp:paragraph -->
|
25
25
|
|
26
26
|
<!-- wp:paragraph -->
|
27
|
-
<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>
|
33
|
+
<p>1st</p>
|
34
34
|
<!-- /wp:paragraph -->
|
35
35
|
|
36
36
|
<!-- wp:paragraph -->
|
37
|
-
<p>
|
37
|
+
<p>2nd</p>
|
38
38
|
<!-- /wp:paragraph -->
|
39
39
|
|
40
40
|
<!-- wp:paragraph -->
|
41
|
-
<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>
|
47
|
+
<p>2nd</p>
|
48
48
|
<!-- /wp:paragraph -->
|
49
49
|
|
50
50
|
<!-- wp:paragraph -->
|
51
|
-
<p>
|
51
|
+
<p>3rd</p>
|
52
52
|
<!-- /wp:paragraph -->
|
53
53
|
|
54
54
|
<!-- wp:paragraph -->
|
55
|
-
<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>
|
61
|
+
<p>1st</p>
|
62
62
|
<!-- /wp:paragraph -->
|
63
63
|
|
64
64
|
<!-- wp:paragraph -->
|
65
|
-
<p>
|
65
|
+
<p>2nd</p>
|
66
66
|
<!-- /wp:paragraph -->
|
67
67
|
|
68
68
|
<!-- wp:paragraph -->
|
69
|
-
<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>
|
75
|
+
<p>1st</p>
|
76
76
|
<!-- /wp:paragraph -->
|
77
77
|
|
78
78
|
<!-- wp:paragraph -->
|
79
|
-
<p>
|
79
|
+
<p>3rd</p>
|
80
80
|
<!-- /wp:paragraph -->
|
81
81
|
|
82
82
|
<!-- wp:paragraph -->
|
83
|
-
<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>
|
89
|
+
<p>1st</p>
|
90
90
|
<!-- /wp:paragraph -->
|
91
91
|
|
92
92
|
<!-- wp:paragraph -->
|
93
|
-
<p>
|
93
|
+
<p>2nd</p>
|
94
94
|
<!-- /wp:paragraph -->
|
95
95
|
|
96
96
|
<!-- wp:paragraph -->
|
97
|
-
<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>
|
103
|
+
<p>3rd</p>
|
104
104
|
<!-- /wp:paragraph -->
|
105
105
|
|
106
106
|
<!-- wp:paragraph -->
|
107
|
-
<p>
|
107
|
+
<p>1st</p>
|
108
108
|
<!-- /wp:paragraph -->
|
109
109
|
|
110
110
|
<!-- wp:paragraph -->
|
111
|
-
<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
|
`;
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
getEditedPostContent,
|
8
8
|
} from '@wordpress/e2e-test-utils';
|
9
9
|
|
10
|
-
/** @typedef {import('puppeteer').ElementHandle} ElementHandle */
|
10
|
+
/** @typedef {import('puppeteer-core').ElementHandle} ElementHandle */
|
11
11
|
|
12
12
|
describe( 'adding patterns', () => {
|
13
13
|
beforeEach( async () => {
|
@@ -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( '
|
16
|
+
await page.keyboard.type( '1st' );
|
14
17
|
await page.keyboard.press( 'Enter' );
|
15
|
-
await page.keyboard.type( '
|
18
|
+
await page.keyboard.type( '2nd' );
|
16
19
|
await page.keyboard.press( 'Enter' );
|
17
|
-
await page.keyboard.type( '
|
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
|
} );
|
@@ -13,6 +13,7 @@ import {
|
|
13
13
|
getAvailableBlockTransforms,
|
14
14
|
activatePlugin,
|
15
15
|
deactivatePlugin,
|
16
|
+
createReusableBlock,
|
16
17
|
} from '@wordpress/e2e-test-utils';
|
17
18
|
|
18
19
|
async function insertBlocksOfSameType() {
|
@@ -122,24 +123,7 @@ describe( 'Block Grouping', () => {
|
|
122
123
|
};
|
123
124
|
|
124
125
|
const paragraphText = 'hi';
|
125
|
-
|
126
|
-
'.reusable-blocks-menu-items__convert-modal .components-text-control__input';
|
127
|
-
await insertBlock( 'Paragraph' );
|
128
|
-
await page.keyboard.type( paragraphText );
|
129
|
-
|
130
|
-
await clickBlockToolbarButton( 'Options' );
|
131
|
-
await clickMenuItem( 'Add to Reusable blocks' );
|
132
|
-
const nameInput = await page.waitForSelector(
|
133
|
-
reusableBlockNameInputSelector
|
134
|
-
);
|
135
|
-
await nameInput.click();
|
136
|
-
await page.keyboard.type( 'Block' );
|
137
|
-
await page.keyboard.press( 'Enter' );
|
138
|
-
|
139
|
-
// Wait for creation to finish
|
140
|
-
await page.waitForXPath(
|
141
|
-
'//*[contains(@class, "components-snackbar")]/*[text()="Reusable block created."]'
|
142
|
-
);
|
126
|
+
await createReusableBlock( paragraphText, 'Block' );
|
143
127
|
// Group
|
144
128
|
await clickBlockToolbarButton( 'Options' );
|
145
129
|
await clickMenuItem( 'Group' );
|
@@ -51,7 +51,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
51
51
|
await page.click( '.edit-post-header-toolbar__list-view-toggle' );
|
52
52
|
const columnsBlockMenuItem = (
|
53
53
|
await page.$x(
|
54
|
-
"//
|
54
|
+
"//a[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Columns')]"
|
55
55
|
)
|
56
56
|
)[ 0 ];
|
57
57
|
await columnsBlockMenuItem.click();
|
@@ -75,7 +75,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
75
75
|
// Navigate to the last column block.
|
76
76
|
const lastColumnsBlockMenuItem = (
|
77
77
|
await page.$x(
|
78
|
-
"//
|
78
|
+
"//a[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Column')]"
|
79
79
|
)
|
80
80
|
)[ 3 ];
|
81
81
|
await lastColumnsBlockMenuItem.click();
|
@@ -188,7 +188,7 @@ describe( 'Navigating the block hierarchy', () => {
|
|
188
188
|
await page.click( '.edit-post-header-toolbar__list-view-toggle' );
|
189
189
|
const groupMenuItem = (
|
190
190
|
await page.$x(
|
191
|
-
"//
|
191
|
+
"//a[contains(@class,'block-editor-list-view-block-select-button') and contains(text(), 'Group')]"
|
192
192
|
)
|
193
193
|
)[ 0 ];
|
194
194
|
await groupMenuItem.click();
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
saveDraft,
|
11
11
|
openDocumentSettingsSidebar,
|
12
12
|
isCurrentURL,
|
13
|
+
openTypographyToolsPanelMenu,
|
13
14
|
} from '@wordpress/e2e-test-utils';
|
14
15
|
|
15
16
|
describe( 'Change detection', () => {
|
@@ -381,6 +382,10 @@ describe( 'Change detection', () => {
|
|
381
382
|
|
382
383
|
// Change the paragraph's `drop cap`.
|
383
384
|
await page.click( '[data-type="core/paragraph"]' );
|
385
|
+
|
386
|
+
await openTypographyToolsPanelMenu();
|
387
|
+
await page.click( 'button[aria-label="Show Drop cap"]' );
|
388
|
+
|
384
389
|
const [ dropCapToggle ] = await page.$x(
|
385
390
|
"//label[contains(text(), 'Drop cap')]"
|
386
391
|
);
|
@@ -10,6 +10,7 @@ import {
|
|
10
10
|
switchEditorModeTo,
|
11
11
|
pressKeyTimes,
|
12
12
|
pressKeyWithModifier,
|
13
|
+
openTypographyToolsPanelMenu,
|
13
14
|
} from '@wordpress/e2e-test-utils';
|
14
15
|
|
15
16
|
describe( 'Editing modes (visual/HTML)', () => {
|
@@ -54,6 +55,9 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
54
55
|
|
55
56
|
// The `drop cap` toggle for the paragraph block should appear, even in
|
56
57
|
// HTML editing mode.
|
58
|
+
await openTypographyToolsPanelMenu();
|
59
|
+
await page.click( 'button[aria-label="Show Drop cap"]' );
|
60
|
+
|
57
61
|
const dropCapToggle = await page.$x(
|
58
62
|
"//label[contains(text(), 'Drop cap')]"
|
59
63
|
);
|
@@ -74,6 +78,9 @@ describe( 'Editing modes (visual/HTML)', () => {
|
|
74
78
|
expect( htmlBlockContent ).toEqual( '<p>Hello world!</p>' );
|
75
79
|
|
76
80
|
// Change the `drop cap` using the sidebar.
|
81
|
+
await openTypographyToolsPanelMenu();
|
82
|
+
await page.click( 'button[aria-label="Show Drop cap"]' );
|
83
|
+
|
77
84
|
const [ dropCapToggle ] = await page.$x(
|
78
85
|
"//label[contains(text(), 'Drop cap')]"
|
79
86
|
);
|
@@ -7,7 +7,7 @@ import {
|
|
7
7
|
createNewPost,
|
8
8
|
pressKeyWithModifier,
|
9
9
|
pressKeyTimes,
|
10
|
-
|
10
|
+
openTypographyToolsPanelMenu,
|
11
11
|
} from '@wordpress/e2e-test-utils';
|
12
12
|
|
13
13
|
const openFontSizeSelectControl = async () => {
|
@@ -17,13 +17,6 @@ const openFontSizeSelectControl = async () => {
|
|
17
17
|
return selectControl.click();
|
18
18
|
};
|
19
19
|
|
20
|
-
const openTypographyToolsPanelMenu = async () => {
|
21
|
-
const toggleSelector =
|
22
|
-
"//div[contains(@class, 'typography-block-support-panel')]//button[contains(@class, 'components-dropdown-menu__toggle')]";
|
23
|
-
const toggle = await page.waitForXPath( toggleSelector );
|
24
|
-
return toggle.click();
|
25
|
-
};
|
26
|
-
|
27
20
|
const FONT_SIZE_TOGGLE_GROUP_SELECTOR =
|
28
21
|
"//div[contains(@class, 'components-font-size-picker__controls')]//div[contains(@class, 'components-toggle-group-control')]";
|
29
22
|
|
@@ -106,21 +99,68 @@ describe( 'Font Size Picker', () => {
|
|
106
99
|
` );
|
107
100
|
} );
|
108
101
|
} );
|
102
|
+
|
109
103
|
// A different control is rendered based on the available font sizes number.
|
110
104
|
describe( 'More font sizes', () => {
|
111
|
-
|
112
|
-
await
|
113
|
-
|
114
|
-
|
115
|
-
|
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
|
+
} );
|
116
155
|
} );
|
156
|
+
|
117
157
|
it( 'should apply a named font size using the font size buttons', async () => {
|
118
158
|
// Create a paragraph block with some content.
|
119
159
|
await clickBlockAppender();
|
120
160
|
await page.keyboard.type( 'Paragraph to be made "large"' );
|
121
161
|
|
122
162
|
await openFontSizeSelectControl();
|
123
|
-
await pressKeyTimes( 'ArrowDown',
|
163
|
+
await pressKeyTimes( 'ArrowDown', 5 );
|
124
164
|
await page.keyboard.press( 'Enter' );
|
125
165
|
|
126
166
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
@@ -137,11 +177,11 @@ describe( 'Font Size Picker', () => {
|
|
137
177
|
);
|
138
178
|
|
139
179
|
await openFontSizeSelectControl();
|
140
|
-
await pressKeyTimes( 'ArrowDown',
|
180
|
+
await pressKeyTimes( 'ArrowDown', 4 );
|
141
181
|
await page.keyboard.press( 'Enter' );
|
142
182
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
143
|
-
"<!-- wp:paragraph {\\"fontSize\\":\\"
|
144
|
-
<p class=\\"has-
|
183
|
+
"<!-- wp:paragraph {\\"fontSize\\":\\"medium\\"} -->
|
184
|
+
<p class=\\"has-medium-font-size\\">Paragraph with font size reset using tools panel menu</p>
|
145
185
|
<!-- /wp:paragraph -->"
|
146
186
|
` );
|
147
187
|
|
@@ -164,7 +204,7 @@ describe( 'Font Size Picker', () => {
|
|
164
204
|
);
|
165
205
|
|
166
206
|
await openFontSizeSelectControl();
|
167
|
-
await pressKeyTimes( 'ArrowDown',
|
207
|
+
await pressKeyTimes( 'ArrowDown', 3 );
|
168
208
|
await page.keyboard.press( 'Enter' );
|
169
209
|
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
|
170
210
|
"<!-- wp:paragraph {\\"fontSize\\":\\"small\\"} -->
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
pressKeyWithModifier,
|
15
15
|
} from '@wordpress/e2e-test-utils';
|
16
16
|
|
17
|
-
/** @typedef {import('puppeteer').ElementHandle} ElementHandle */
|
17
|
+
/** @typedef {import('puppeteer-core').ElementHandle} ElementHandle */
|
18
18
|
|
19
19
|
/**
|
20
20
|
* Waits for all patterns in the inserter to have a height, which should
|
@@ -173,7 +173,7 @@ describe( 'Inserting blocks', () => {
|
|
173
173
|
// Check for regression of https://github.com/WordPress/gutenberg/issues/9583
|
174
174
|
it( 'should not allow transfer of focus outside of the block-insertion menu once open', async () => {
|
175
175
|
// Enter the default block and click the inserter toggle button to the left of it.
|
176
|
-
await page.keyboard.press( '
|
176
|
+
await page.keyboard.press( 'Enter' );
|
177
177
|
await showBlockToolbar();
|
178
178
|
await page.click(
|
179
179
|
'.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle'
|
@@ -243,6 +243,10 @@ describe( 'Inserting blocks', () => {
|
|
243
243
|
);
|
244
244
|
expect( selectedButtonBlocks.length ).toBe( 1 );
|
245
245
|
|
246
|
+
// The block appender is only visible when there's no selection.
|
247
|
+
await page.evaluate( () =>
|
248
|
+
window.wp.data.dispatch( 'core/block-editor' ).clearSelectedBlock()
|
249
|
+
);
|
246
250
|
// Specifically click the root container appender.
|
247
251
|
await page.click(
|
248
252
|
'.block-editor-block-list__layout.is-root-container > .block-list-appender .block-editor-inserter__toggle'
|
@@ -155,6 +155,12 @@ describe( 'Order of block keyboard navigation', () => {
|
|
155
155
|
.focus();
|
156
156
|
} );
|
157
157
|
|
158
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
159
|
+
await expect( await getActiveLabel() ).toBe( 'Add block' );
|
160
|
+
|
161
|
+
await pressKeyWithModifier( 'shift', 'Tab' );
|
162
|
+
await expect( await getActiveLabel() ).toBe( 'Add default block' );
|
163
|
+
|
158
164
|
await pressKeyWithModifier( 'shift', 'Tab' );
|
159
165
|
await expect( await getActiveLabel() ).toBe(
|
160
166
|
'Paragraph Block. Row 2. 1'
|
@@ -42,12 +42,12 @@ describe( 'List view', () => {
|
|
42
42
|
await pressKeyWithModifier( 'access', 'o' );
|
43
43
|
|
44
44
|
const paragraphBlock = await page.waitForXPath(
|
45
|
-
'//
|
45
|
+
'//a[contains(., "Paragraph")][@draggable="true"]'
|
46
46
|
);
|
47
47
|
|
48
48
|
// Drag above the heading block
|
49
49
|
const headingBlock = await page.waitForXPath(
|
50
|
-
'//
|
50
|
+
'//a[contains(., "Heading")][@draggable="true"]'
|
51
51
|
);
|
52
52
|
|
53
53
|
await dragAndDrop( paragraphBlock, headingBlock, -5 );
|
@@ -31,8 +31,8 @@ describe.each( [
|
|
31
31
|
|
32
32
|
it( 'navigates in and out of toolbar by keyboard (Alt+F10, Escape)', async () => {
|
33
33
|
// Assumes new post focus starts in title. Create first new
|
34
|
-
// block by
|
35
|
-
await page.keyboard.press( '
|
34
|
+
// block by Enter.
|
35
|
+
await page.keyboard.press( 'Enter' );
|
36
36
|
|
37
37
|
// [TEMPORARY]: A new paragraph is not technically a block yet
|
38
38
|
// until starting to type within it.
|
@@ -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( '
|
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' );
|