Skip to content

Commit eaac5c4

Browse files
Update font size picker reset e2e tests for ToolsPanel
1 parent e79628d commit eaac5c4

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

packages/e2e-tests/specs/editor/various/font-size-picker.test.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ const openFontSizeSelectControl = async () => {
1717
return selectControl.click();
1818
};
1919

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+
2027
const FONT_SIZE_TOGGLE_GROUP_SELECTOR =
2128
"//div[contains(@class, 'components-font-size-picker__controls')]//div[contains(@class, 'components-toggle-group-control')]";
2229

@@ -122,31 +129,29 @@ describe( 'Font Size Picker', () => {
122129
<!-- /wp:paragraph -->"
123130
` );
124131
} );
125-
it( 'should reset a named font size using the reset button', async () => {
132+
it( 'should reset a named font size using the tools panel menu', async () => {
126133
// Create a paragraph block with some content.
127134
await clickBlockAppender();
128135
await page.keyboard.type(
129-
'Paragraph with font size reset using button'
136+
'Paragraph with font size reset using tools panel menu'
130137
);
131138

132139
await openFontSizeSelectControl();
133140
await pressKeyTimes( 'ArrowDown', 3 );
134141
await page.keyboard.press( 'Enter' );
135142
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
136143
"<!-- wp:paragraph {\\"fontSize\\":\\"normal\\"} -->
137-
<p class=\\"has-normal-font-size\\">Paragraph with font size reset using button</p>
144+
<p class=\\"has-normal-font-size\\">Paragraph with font size reset using tools panel menu</p>
138145
<!-- /wp:paragraph -->"
139146
` );
140147

141-
await toggleCustomInput( true );
142-
await page.keyboard.press( 'Tab' );
143-
await page.keyboard.press( 'Tab' );
144-
await page.keyboard.press( 'Tab' );
148+
// Open Typography ToolsPanel, font size will be first in menu and gain focus.
149+
await openTypographyToolsPanelMenu();
145150

146151
await page.keyboard.press( 'Enter' );
147152
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
148153
"<!-- wp:paragraph -->
149-
<p>Paragraph with font size reset using button</p>
154+
<p>Paragraph with font size reset using tools panel menu</p>
150155
<!-- /wp:paragraph -->"
151156
` );
152157
} );
@@ -205,29 +210,27 @@ describe( 'Font Size Picker', () => {
205210
` );
206211
} );
207212

208-
it( 'should reset a named font size using the reset button', async () => {
213+
it( 'should reset a named font size using the tools panel menu', async () => {
209214
// Create a paragraph block with some content.
210215
await clickBlockAppender();
211216
await page.keyboard.type(
212-
'Paragraph with font size reset using button'
217+
'Paragraph with font size reset using tools panel menu'
213218
);
214219

215220
await clickFontSizeButtonByLabel( 'Small' );
216221
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
217222
"<!-- wp:paragraph {\\"fontSize\\":\\"small\\"} -->
218-
<p class=\\"has-small-font-size\\">Paragraph with font size reset using button</p>
223+
<p class=\\"has-small-font-size\\">Paragraph with font size reset using tools panel menu</p>
219224
<!-- /wp:paragraph -->"
220225
` );
221226

222-
await toggleCustomInput( true );
223-
await page.keyboard.press( 'Tab' );
224-
await page.keyboard.press( 'Tab' );
225-
await page.keyboard.press( 'Tab' );
227+
// Open Typography ToolsPanel, font size will be first in menu and gain focus.
228+
await openTypographyToolsPanelMenu();
226229

227230
await page.keyboard.press( 'Enter' );
228231
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
229232
"<!-- wp:paragraph -->
230-
<p>Paragraph with font size reset using button</p>
233+
<p>Paragraph with font size reset using tools panel menu</p>
231234
<!-- /wp:paragraph -->"
232235
` );
233236
} );

0 commit comments

Comments
 (0)