diff --git a/packages/e2e-tests/specs/editor/various/font-size-picker.test.js b/packages/e2e-tests/specs/editor/various/font-size-picker.test.js index bb740cae8981c5..f7351450dabd51 100644 --- a/packages/e2e-tests/specs/editor/various/font-size-picker.test.js +++ b/packages/e2e-tests/specs/editor/various/font-size-picker.test.js @@ -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', + }, + ] ) ); } ); @@ -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( ` @@ -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( ` " @@ -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( ` "