Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 53 additions & 45 deletions packages/e2e-tests/specs/editor/various/font-size-picker.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,51 +102,59 @@ describe( 'Font Size Picker', () => {
describe( 'More font sizes', () => {
beforeEach( async () => {
await page.evaluate( () => {
// set a deep `path[]` property in object `obj` to `value`, immutably
function setDeep( obj, path, value ) {
function doSet( o, i ) {
if ( i < path.length ) {
const key = path[ i ];
return { ...o, [ key ]: doSet( o[ key ], i + 1 ) };
}
return value;
}
return doSet( obj, 0 );
}

wp.data.dispatch( 'core/block-editor' ).updateSettings(
// eslint-disable-next-line no-undef
lodash.merge(
setDeep(
wp.data.select( 'core/block-editor' ).getSettings(),
{
__experimentalFeatures: {
typography: {
fontSizes: {
default: [
{
name: 'Tiny',
slug: 'tiny',
size: '11px',
},
,
{
name: 'Small',
slug: 'small',
size: '13px',
},
{
name: 'Medium',
slug: 'medium',
size: '20px',
},
{
name: 'Large',
slug: 'large',
size: '36px',
},
{
name: 'Extra Large',
slug: 'x-large',
size: '42px',
},
{
name: 'Huge',
slug: 'huge',
size: '48px',
},
],
},
},
[
'__experimentalFeatures',
'typography',
'fontSizes',
'default',
],
[
{
name: 'Tiny',
slug: 'tiny',
size: '11px',
},
}
{
name: 'Small',
slug: 'small',
size: '13px',
},
{
name: 'Medium',
slug: 'medium',
size: '20px',
},
{
name: 'Large',
slug: 'large',
size: '36px',
},
{
name: 'Extra Large',
slug: 'x-large',
size: '42px',
},
{
name: 'Huge',
slug: 'huge',
size: '48px',
},
]
)
);
} );
Expand All @@ -158,7 +166,7 @@ describe( 'Font Size Picker', () => {
await page.keyboard.type( 'Paragraph to be made "large"' );

await openFontSizeSelectControl();
await pressKeyTimes( 'ArrowDown', 5 );
await pressKeyTimes( 'ArrowDown', 4 );
await page.keyboard.press( 'Enter' );

expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
Expand All @@ -175,7 +183,7 @@ describe( 'Font Size Picker', () => {
);

await openFontSizeSelectControl();
await pressKeyTimes( 'ArrowDown', 4 );
await pressKeyTimes( 'ArrowDown', 3 );
await page.keyboard.press( 'Enter' );
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
"<!-- wp:paragraph {\\"fontSize\\":\\"medium\\"} -->
Expand All @@ -202,7 +210,7 @@ describe( 'Font Size Picker', () => {
);

await openFontSizeSelectControl();
await pressKeyTimes( 'ArrowDown', 3 );
await pressKeyTimes( 'ArrowDown', 2 );
await page.keyboard.press( 'Enter' );
expect( await getEditedPostContent() ).toMatchInlineSnapshot( `
"<!-- wp:paragraph {\\"fontSize\\":\\"small\\"} -->
Expand Down