${ circleString }` );
const validateSvgIcon = ( iconHtml ) => {
@@ -109,16 +111,16 @@ describe( 'Correctly Renders Block Icons on Inserter and Inspector', () => {
it( 'Renders the icon in the inserter with the correct colors', async () => {
await searchForBlock( blockTitle );
validateDashIcon( await getFirstInserterIcon() );
- expect( await getBackgroundColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual( 'rgb(1, 0, 0)' );
+ expect( await getBackgroundColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual(
+ 'rgb(1, 0, 0)'
+ );
expect( await getColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual( 'rgb(254, 0, 0)' );
} );
it( 'Renders the icon in the inspector with the correct colors', async () => {
await insertBlock( blockTitle );
await selectFirstBlock();
- validateDashIcon(
- await getInnerHTML( INSPECTOR_ICON_SELECTOR )
- );
+ validateDashIcon( await getInnerHTML( INSPECTOR_ICON_SELECTOR ) );
expect( await getBackgroundColor( INSPECTOR_ICON_SELECTOR ) ).toEqual( 'rgb(1, 0, 0)' );
expect( await getColor( INSPECTOR_ICON_SELECTOR ) ).toEqual( 'rgb(254, 0, 0)' );
} );
@@ -129,16 +131,16 @@ describe( 'Correctly Renders Block Icons on Inserter and Inspector', () => {
it( 'Renders the icon in the inserter with the correct background color and an automatically compute readable foreground color', async () => {
await searchForBlock( blockTitle );
validateSvgIcon( await getFirstInserterIcon() );
- expect( await getBackgroundColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual( 'rgb(1, 0, 0)' );
+ expect( await getBackgroundColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual(
+ 'rgb(1, 0, 0)'
+ );
expect( await getColor( INSERTER_ICON_WRAPPER_SELECTOR ) ).toEqual( 'rgb(248, 249, 249)' );
} );
it( 'Renders correctly the icon on the inspector', async () => {
await insertBlock( blockTitle );
await selectFirstBlock();
- validateSvgIcon(
- await getInnerHTML( INSPECTOR_ICON_SELECTOR )
- );
+ validateSvgIcon( await getInnerHTML( INSPECTOR_ICON_SELECTOR ) );
expect( await getBackgroundColor( INSPECTOR_ICON_SELECTOR ) ).toEqual( 'rgb(1, 0, 0)' );
expect( await getColor( INSPECTOR_ICON_SELECTOR ) ).toEqual( 'rgb(248, 249, 249)' );
} );
diff --git a/packages/e2e-tests/specs/editor/plugins/container-blocks.test.js b/packages/e2e-tests/specs/editor/plugins/container-blocks.test.js
index 4afa4273f373fa..6314658076c96d 100644
--- a/packages/e2e-tests/specs/editor/plugins/container-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/container-blocks.test.js
@@ -31,10 +31,18 @@ describe( 'InnerBlocks Template Sync', () => {
`;
await insertBlock( blockName );
await switchEditorModeTo( 'Code' );
- await page.$eval( '.editor-post-text-editor', ( element, _paragraph, _blockSlug ) => {
- const blockDelimiter = ``;
- element.value = element.value.replace( blockDelimiter, `${ _paragraph }${ blockDelimiter }` );
- }, paragraphToAdd, blockSlug );
+ await page.$eval(
+ '.editor-post-text-editor',
+ ( element, _paragraph, _blockSlug ) => {
+ const blockDelimiter = ``;
+ element.value = element.value.replace(
+ blockDelimiter,
+ `${ _paragraph }${ blockDelimiter }`
+ );
+ },
+ paragraphToAdd,
+ blockSlug
+ );
// Press "Enter" inside the Code Editor to fire the `onChange` event for the new value.
await page.click( '.editor-post-text-editor' );
await page.keyboard.press( 'Enter' );
@@ -42,12 +50,18 @@ describe( 'InnerBlocks Template Sync', () => {
};
it( 'Ensures blocks without locking are kept intact even if they do not match the template ', async () => {
- await insertBlockAndAddParagraphInside( 'Test Inner Blocks no locking', 'test/test-inner-blocks-no-locking' );
+ await insertBlockAndAddParagraphInside(
+ 'Test Inner Blocks no locking',
+ 'test/test-inner-blocks-no-locking'
+ );
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
it( 'Removes blocks that are not expected by the template if a lock all exists ', async () => {
- await insertBlockAndAddParagraphInside( 'Test InnerBlocks locking all', 'test/test-inner-blocks-locking-all' );
+ await insertBlockAndAddParagraphInside(
+ 'Test InnerBlocks locking all',
+ 'test/test-inner-blocks-locking-all'
+ );
expect( await getEditedPostContent() ).toMatchSnapshot();
} );
@@ -78,12 +92,12 @@ describe( 'Container block without paragraph support', () => {
await insertBlock( 'Container without paragraph' );
// Open the specific appender used when there's no paragraph support.
- await page.click( '.block-editor-inner-blocks .block-list-appender .block-list-appender__toggle' );
+ await page.click(
+ '.block-editor-inner-blocks .block-list-appender .block-list-appender__toggle'
+ );
// Insert an image block.
- const insertButton = ( await page.$x(
- `//button//span[contains(text(), 'Image')]`
- ) )[ 0 ];
+ const insertButton = ( await page.$x( `//button//span[contains(text(), 'Image')]` ) )[ 0 ];
await insertButton.click();
// Check the inserted content.
diff --git a/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js b/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js
index 74f8f81bf67e3f..5dae6775a9935f 100644
--- a/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/cpt-locking.test.js
@@ -22,24 +22,18 @@ describe( 'cpt locking', () => {
} );
const shouldRemoveTheInserter = async () => {
- expect(
- await page.$( '.edit-post-header [aria-label="Add block"]' )
- ).toBeNull();
+ expect( await page.$( '.edit-post-header [aria-label="Add block"]' ) ).toBeNull();
};
const shouldNotAllowBlocksToBeRemoved = async () => {
await page.type( '.editor-rich-text__editable.wp-block-paragraph', 'p1' );
await clickBlockToolbarButton( 'More options' );
- expect(
- await page.$x( '//button[contains(text(), "Remove Block")]' )
- ).toHaveLength( 0 );
+ expect( await page.$x( '//button[contains(text(), "Remove Block")]' ) ).toHaveLength( 0 );
};
const shouldAllowBlocksToBeMoved = async () => {
await page.click( '.editor-rich-text__editable.wp-block-paragraph' );
- expect(
- await page.$( 'button[aria-label="Move up"]' )
- ).not.toBeNull();
+ expect( await page.$( 'button[aria-label="Move up"]' ) ).not.toBeNull();
await page.click( 'button[aria-label="Move up"]' );
await page.type( '.editor-rich-text__editable.wp-block-paragraph', 'p1' );
expect( await getEditedPostContent() ).toMatchSnapshot();
@@ -56,9 +50,7 @@ describe( 'cpt locking', () => {
it( 'should not allow blocks to be moved', async () => {
await page.click( '.editor-rich-text__editable.wp-block-paragraph' );
- expect(
- await page.$( 'button[aria-label="Move up"]' )
- ).toBeNull();
+ expect( await page.$( 'button[aria-label="Move up"]' ) ).toBeNull();
} );
it( 'should not error when deleting the cotents of a paragraph', async () => {
@@ -73,14 +65,17 @@ describe( 'cpt locking', () => {
const content = await getEditedPostContent();
const [ , contentWithoutImage ] = content.split( '' );
await setPostContent( contentWithoutImage );
- const VALIDATION_PARAGRAPH_SELECTOR = '.editor-template-validation-notice .components-notice__content p';
+ const VALIDATION_PARAGRAPH_SELECTOR =
+ '.editor-template-validation-notice .components-notice__content p';
await page.waitForSelector( VALIDATION_PARAGRAPH_SELECTOR );
expect(
await page.evaluate(
( element ) => element.textContent,
await page.$( VALIDATION_PARAGRAPH_SELECTOR )
)
- ).toEqual( 'The content of your post doesn’t match the template assigned to your post type.' );
+ ).toEqual(
+ 'The content of your post doesn’t match the template assigned to your post type.'
+ );
} );
} );
@@ -102,9 +97,7 @@ describe( 'cpt locking', () => {
} );
it( 'should allow blocks to be inserted', async () => {
- expect(
- await page.$( '.edit-post-header [aria-label="Add block"]' )
- ).not.toBeNull();
+ expect( await page.$( '.edit-post-header [aria-label="Add block"]' ) ).not.toBeNull();
await insertBlock( 'List' );
await page.keyboard.type( 'List content' );
expect( await getEditedPostContent() ).toMatchSnapshot();
diff --git a/packages/e2e-tests/specs/editor/plugins/custom-taxonomies.test.js b/packages/e2e-tests/specs/editor/plugins/custom-taxonomies.test.js
index fccba18eafae1d..4eb0ebff2e5e22 100644
--- a/packages/e2e-tests/specs/editor/plugins/custom-taxonomies.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/custom-taxonomies.test.js
@@ -4,7 +4,9 @@
import {
activatePlugin,
createNewPost,
- deactivatePlugin, findSidebarPanelWithTitle, openDocumentSettingsSidebar,
+ deactivatePlugin,
+ findSidebarPanelWithTitle,
+ openDocumentSettingsSidebar,
} from '@wordpress/e2e-test-utils';
describe( 'Custom Taxonomies labels are used', () => {
@@ -36,7 +38,9 @@ describe( 'Custom Taxonomies labels are used', () => {
}
// Check the add new button
- const labelNew = await page.$x( "//label[@class='components-form-token-field__label' and contains(text(), 'Add New Model')]" );
+ const labelNew = await page.$x(
+ "//label[@class='components-form-token-field__label' and contains(text(), 'Add New Model')]"
+ );
expect( labelNew ).not.toBeFalsy();
// Fill with one entry
@@ -44,7 +48,9 @@ describe( 'Custom Taxonomies labels are used', () => {
await page.keyboard.press( 'Enter' );
// Check the "Remove Model"
- const value = await page.$x( "//div[@class='components-form-token-field__input-container']//span//button[@aria-label='Remove Model']" );
+ const value = await page.$x(
+ "//div[@class='components-form-token-field__input-container']//span//button[@aria-label='Remove Model']"
+ );
expect( value ).not.toBeFalsy();
} );
} );
diff --git a/packages/e2e-tests/specs/editor/plugins/hooks-api.test.js b/packages/e2e-tests/specs/editor/plugins/hooks-api.test.js
index 4641c534493b3f..3b09ebe0e2ddcf 100644
--- a/packages/e2e-tests/specs/editor/plugins/hooks-api.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/hooks-api.test.js
@@ -31,7 +31,10 @@ describe( 'Using Hooks API', () => {
it( 'Pressing reset block button resets the block', async () => {
await clickBlockAppender();
await page.keyboard.type( 'First paragraph' );
- const paragraphContent = await page.$eval( 'div[data-type="core/paragraph"] p', ( element ) => element.textContent );
+ const paragraphContent = await page.$eval(
+ 'div[data-type="core/paragraph"] p',
+ ( element ) => element.textContent
+ );
expect( paragraphContent ).toEqual( 'First paragraph' );
await page.click( '.edit-post-sidebar .e2e-reset-block-button' );
expect( await getEditedPostContent() ).toMatchSnapshot();
diff --git a/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js b/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js
index c0a2055ade7623..04563489829675 100644
--- a/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js
@@ -33,9 +33,7 @@ describe( 'Allowed Blocks Setting on InnerBlocks ', () => {
await page.click( childParagraphSelector );
await openGlobalBlockInserter();
await openAllBlockInserterCategories();
- expect(
- ( await getAllBlockInserterItemTitles() ).length
- ).toBeGreaterThan( 20 );
+ expect( ( await getAllBlockInserterItemTitles() ).length ).toBeGreaterThan( 20 );
} );
it( 'allows the blocks if the allowed blocks setting was set', async () => {
@@ -46,9 +44,7 @@ describe( 'Allowed Blocks Setting on InnerBlocks ', () => {
await page.click( childParagraphSelector );
await openGlobalBlockInserter();
await openAllBlockInserterCategories();
- expect(
- await getAllBlockInserterItemTitles()
- ).toEqual( [
+ expect( await getAllBlockInserterItemTitles() ).toEqual( [
'Button',
'Gallery',
'List',
@@ -65,24 +61,12 @@ describe( 'Allowed Blocks Setting on InnerBlocks ', () => {
await page.waitForSelector( appenderSelector );
await page.click( appenderSelector );
await openAllBlockInserterCategories();
- expect(
- await getAllBlockInserterItemTitles()
- ).toEqual( [
- 'Image',
- 'List',
- ] );
- const insertButton = ( await page.$x(
- `//button//span[contains(text(), 'List')]`
- ) )[ 0 ];
+ expect( await getAllBlockInserterItemTitles() ).toEqual( [ 'Image', 'List' ] );
+ const insertButton = ( await page.$x( `//button//span[contains(text(), 'List')]` ) )[ 0 ];
await insertButton.click();
await insertBlock( 'Image' );
await page.click( appenderSelector );
await openAllBlockInserterCategories();
- expect(
- await getAllBlockInserterItemTitles()
- ).toEqual( [
- 'Gallery',
- 'Video',
- ] );
+ expect( await getAllBlockInserterItemTitles() ).toEqual( [ 'Gallery', 'Video' ] );
} );
} );
diff --git a/packages/e2e-tests/specs/editor/plugins/meta-attribute-block.test.js b/packages/e2e-tests/specs/editor/plugins/meta-attribute-block.test.js
index 934e2ac73d69d0..68f4de2768fbb5 100644
--- a/packages/e2e-tests/specs/editor/plugins/meta-attribute-block.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/meta-attribute-block.test.js
@@ -40,7 +40,9 @@ describe( 'Block with a meta attribute', () => {
await page.reload();
expect( await getEditedPostContent() ).toMatchSnapshot();
- const persistedValue = await page.evaluate( () => document.querySelector( '.my-meta-input' ).value );
+ const persistedValue = await page.evaluate(
+ () => document.querySelector( '.my-meta-input' ).value
+ );
expect( persistedValue ).toBe( 'Meta Value' );
} );
@@ -51,15 +53,17 @@ describe( 'Block with a meta attribute', () => {
await page.keyboard.type( 'Meta Value' );
const inputs = await page.$$( '.my-meta-input' );
- await Promise.all( inputs.map( async ( input ) => {
- // Clicking the input selects the block,
- // and selecting the block enables the sync data mode
- // as otherwise the asynchronous re-rendering of unselected blocks
- // may cause the input to have not yet been updated for the other blocks
- await input.click();
- const inputValue = await input.getProperty( 'value' );
- expect( await inputValue.jsonValue() ).toBe( 'Meta Value' );
- } ) );
+ await Promise.all(
+ inputs.map( async ( input ) => {
+ // Clicking the input selects the block,
+ // and selecting the block enables the sync data mode
+ // as otherwise the asynchronous re-rendering of unselected blocks
+ // may cause the input to have not yet been updated for the other blocks
+ await input.click();
+ const inputValue = await input.getProperty( 'value' );
+ expect( await inputValue.jsonValue() ).toBe( 'Meta Value' );
+ } )
+ );
} );
it( 'Should persist the meta attribute properly in a different post type', async () => {
@@ -79,7 +83,9 @@ describe( 'Block with a meta attribute', () => {
await page.reload();
expect( await getEditedPostContent() ).toMatchSnapshot();
- const persistedValue = await page.evaluate( () => document.querySelector( '.my-meta-input' ).value );
+ const persistedValue = await page.evaluate(
+ () => document.querySelector( '.my-meta-input' ).value
+ );
expect( persistedValue ).toBe( 'Meta Value' );
} );
} );
diff --git a/packages/e2e-tests/specs/editor/plugins/meta-boxes.test.js b/packages/e2e-tests/specs/editor/plugins/meta-boxes.test.js
index 0a21dfe20d9d72..8258a40348448f 100644
--- a/packages/e2e-tests/specs/editor/plugins/meta-boxes.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/meta-boxes.test.js
@@ -74,11 +74,7 @@ describe( 'Meta boxes', () => {
// Retrieve the excerpt used as meta
const metaExcerpt = await page.evaluate( () => {
- return document.querySelector(
- 'meta[property="gutenberg:hello"]'
- ).getAttribute(
- 'content'
- );
+ return document.querySelector( 'meta[property="gutenberg:hello"]' ).getAttribute( 'content' );
} );
expect( metaExcerpt ).toEqual( 'Excerpt from content.' );
@@ -109,11 +105,7 @@ describe( 'Meta boxes', () => {
// Retrieve the excerpt used as meta
const metaExcerpt = await page.evaluate( () => {
- return document.querySelector(
- 'meta[property="gutenberg:hello"]'
- ).getAttribute(
- 'content'
- );
+ return document.querySelector( 'meta[property="gutenberg:hello"]' ).getAttribute( 'content' );
} );
expect( metaExcerpt ).toEqual( 'Explicitly set excerpt.' );
diff --git a/packages/e2e-tests/specs/editor/plugins/plugins-api.test.js b/packages/e2e-tests/specs/editor/plugins/plugins-api.test.js
index fedf3f25503c4d..3e511f49fae9ac 100644
--- a/packages/e2e-tests/specs/editor/plugins/plugins-api.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/plugins-api.test.js
@@ -30,7 +30,10 @@ describe( 'Using Plugins API', () => {
it( 'Should render post status info inside Document Setting sidebar', async () => {
await openDocumentSettingsSidebar();
- const pluginPostStatusInfoText = await page.$eval( '.edit-post-post-status .my-post-status-info-plugin', ( el ) => el.innerText );
+ const pluginPostStatusInfoText = await page.$eval(
+ '.edit-post-post-status .my-post-status-info-plugin',
+ ( el ) => el.innerText
+ );
expect( pluginPostStatusInfoText ).toBe( 'My post status info' );
} );
} );
@@ -45,14 +48,20 @@ describe( 'Using Plugins API', () => {
it( 'Should render publish panel inside Pre-publish sidebar', async () => {
await openPublishPanel();
- const pluginPublishPanelText = await page.$eval( '.editor-post-publish-panel .my-publish-panel-plugin__pre', ( el ) => el.innerText );
+ const pluginPublishPanelText = await page.$eval(
+ '.editor-post-publish-panel .my-publish-panel-plugin__pre',
+ ( el ) => el.innerText
+ );
expect( pluginPublishPanelText ).toMatch( 'My pre publish panel' );
} );
it( 'Should render publish panel inside Post-publish sidebar', async () => {
await publishPost();
- const pluginPublishPanelText = await page.$eval( '.editor-post-publish-panel .my-publish-panel-plugin__post', ( el ) => el.innerText );
+ const pluginPublishPanelText = await page.$eval(
+ '.editor-post-publish-panel .my-publish-panel-plugin__post',
+ ( el ) => el.innerText
+ );
expect( pluginPublishPanelText ).toMatch( 'My post publish panel' );
} );
} );
@@ -89,7 +98,10 @@ describe( 'Using Plugins API', () => {
it( 'Should open plugins sidebar using More Menu item and render content', async () => {
await clickOnMoreMenuItem( 'Sidebar title plugin' );
- const pluginSidebarContent = await page.$eval( '.edit-post-sidebar', ( el ) => el.innerHTML );
+ const pluginSidebarContent = await page.$eval(
+ '.edit-post-sidebar',
+ ( el ) => el.innerHTML
+ );
expect( pluginSidebarContent ).toMatchSnapshot();
} );
} );
@@ -98,7 +110,10 @@ describe( 'Using Plugins API', () => {
describe( 'Document Setting Custom Panel', () => {
it( 'Should render a custom panel inside Document Setting sidebar', async () => {
await openDocumentSettingsSidebar();
- const pluginDocumentSettingsText = await page.$eval( '.edit-post-sidebar .my-document-setting-plugin', ( el ) => el.innerText );
+ const pluginDocumentSettingsText = await page.$eval(
+ '.edit-post-sidebar .my-document-setting-plugin',
+ ( el ) => el.innerText
+ );
expect( pluginDocumentSettingsText ).toMatchSnapshot();
} );
} );
diff --git a/packages/e2e-tests/specs/editor/plugins/templates.test.js b/packages/e2e-tests/specs/editor/plugins/templates.test.js
index 749842554fe664..e63b80e31322bf 100644
--- a/packages/e2e-tests/specs/editor/plugins/templates.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/templates.test.js
@@ -66,10 +66,7 @@ describe( 'templates', () => {
await switchUserToAdmin();
await visitAdminPage( 'options-writing.php' );
await page.select( '#default_post_format', format );
- await Promise.all( [
- page.waitForNavigation(),
- page.click( '#submit' ),
- ] );
+ await Promise.all( [ page.waitForNavigation(), page.click( '#submit' ) ] );
await switchUserToTest();
}
diff --git a/packages/e2e-tests/specs/editor/plugins/wp-editor-meta-box.test.js b/packages/e2e-tests/specs/editor/plugins/wp-editor-meta-box.test.js
index 32286764092f17..95f99277f9ba5d 100644
--- a/packages/e2e-tests/specs/editor/plugins/wp-editor-meta-box.test.js
+++ b/packages/e2e-tests/specs/editor/plugins/wp-editor-meta-box.test.js
@@ -33,10 +33,7 @@ describe( 'WP Editor Meta Boxes', () => {
await expect( page ).toClick( '#test_tinymce_id-html' );
await page.waitForSelector( '#test_tinymce_id' );
- const content = await page.$eval(
- '#test_tinymce_id',
- ( textarea ) => textarea.value
- );
+ const content = await page.$eval( '#test_tinymce_id', ( textarea ) => textarea.value );
expect( content ).toMatchSnapshot();
} );
diff --git a/packages/e2e-tests/specs/editor/various/a11y.test.js b/packages/e2e-tests/specs/editor/various/a11y.test.js
index 6f6cc960f204aa..996d14ad250070 100644
--- a/packages/e2e-tests/specs/editor/various/a11y.test.js
+++ b/packages/e2e-tests/specs/editor/various/a11y.test.js
@@ -1,10 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- createNewPost,
- pressKeyWithModifier,
-} from '@wordpress/e2e-test-utils';
+import { createNewPost, pressKeyWithModifier } from '@wordpress/e2e-test-utils';
function isCloseButtonFocused() {
return page.$eval( ':focus', ( focusedElement ) => {
diff --git a/packages/e2e-tests/specs/editor/various/adding-blocks.test.js b/packages/e2e-tests/specs/editor/various/adding-blocks.test.js
index 56e5976513746d..e2255b1ae8e9aa 100644
--- a/packages/e2e-tests/specs/editor/various/adding-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/various/adding-blocks.test.js
@@ -23,7 +23,7 @@ describe( 'adding blocks', () => {
*/
async function clickBelow( elementHandle ) {
const box = await elementHandle.boundingBox();
- const x = box.x + ( box.width / 2 );
+ const x = box.x + box.width / 2;
const y = box.y + box.height + 100;
return page.mouse.click( x, y );
}
@@ -84,17 +84,20 @@ describe( 'adding blocks', () => {
await page.click( '.editor-post-title__input' );
// Using the between inserter
- const insertionPoint = await page.$( '[data-type="core/quote"] .block-editor-inserter__toggle' );
+ const insertionPoint = await page.$(
+ '[data-type="core/quote"] .block-editor-inserter__toggle'
+ );
const rect = await insertionPoint.boundingBox();
- await page.mouse.move( rect.x + ( rect.width / 2 ), rect.y + ( rect.height / 2 ), { steps: 10 } );
+ await page.mouse.move( rect.x + rect.width / 2, rect.y + rect.height / 2, { steps: 10 } );
await page.waitForSelector( '[data-type="core/quote"] .block-editor-inserter__toggle' );
await page.click( '[data-type="core/quote"] .block-editor-inserter__toggle' );
// [TODO]: Search input should be focused immediately. It shouldn't be
// necessary to have `waitForFunction`.
- await page.waitForFunction( () => (
- document.activeElement &&
- document.activeElement.classList.contains( 'block-editor-inserter__search' )
- ) );
+ await page.waitForFunction(
+ () =>
+ document.activeElement &&
+ document.activeElement.classList.contains( 'block-editor-inserter__search' )
+ );
await page.keyboard.type( 'para' );
await pressKeyTimes( 'Tab', 3 );
await page.keyboard.press( 'Enter' );
@@ -109,7 +112,9 @@ describe( 'adding blocks', () => {
it( 'should not allow transfer of focus outside of the block-insertion menu once open', async () => {
// Enter the default block and click the inserter toggle button to the left of it.
await page.keyboard.press( 'ArrowDown' );
- await page.click( '.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle' );
+ await page.click(
+ '.block-editor-block-list__empty-block-inserter .block-editor-inserter__toggle'
+ );
// Expect the inserter search input to be the active element.
let activeElementClassList = await page.evaluate( () => document.activeElement.classList );
diff --git a/packages/e2e-tests/specs/editor/various/adding-inline-tokens.test.js b/packages/e2e-tests/specs/editor/various/adding-inline-tokens.test.js
index b11077e70fb3d3..6c44e00ae71805 100644
--- a/packages/e2e-tests/specs/editor/various/adding-inline-tokens.test.js
+++ b/packages/e2e-tests/specs/editor/various/adding-inline-tokens.test.js
@@ -33,7 +33,14 @@ describe( 'adding inline tokens', () => {
// Wait for media modal to appear and upload image.
await page.waitForSelector( '.media-modal input[type=file]' );
const inputElement = await page.$( '.media-modal input[type=file]' );
- const testImagePath = path.join( __dirname, '..', '..', '..', 'assets', '10x10_e2e_test_image_z9T8jK.png' );
+ const testImagePath = path.join(
+ __dirname,
+ '..',
+ '..',
+ '..',
+ 'assets',
+ '10x10_e2e_test_image_z9T8jK.png'
+ );
const filename = uuid();
const tmpFileName = path.join( os.tmpdir(), filename + '.png' );
fs.copyFileSync( testImagePath, tmpFileName );
@@ -46,7 +53,9 @@ describe( 'adding inline tokens', () => {
await page.click( '.media-modal button.media-button-select' );
// Check the content.
- const regex = new RegExp( `\\s*a <\\/p>\\s*` );
+ const regex = new RegExp(
+ `\\s*
a <\\/p>\\s*`
+ );
expect( await getEditedPostContent() ).toMatch( regex );
} );
} );
diff --git a/packages/e2e-tests/specs/editor/various/autosave.test.js b/packages/e2e-tests/specs/editor/various/autosave.test.js
index 9f97f0f1c3f291..2f71696c82e655 100644
--- a/packages/e2e-tests/specs/editor/various/autosave.test.js
+++ b/packages/e2e-tests/specs/editor/various/autosave.test.js
@@ -14,16 +14,17 @@ import {
// Constant to override editor preference
const AUTOSAVE_INTERVAL_SECONDS = 5;
-const AUTOSAVE_NOTICE_REMOTE = 'There is an autosave of this post that is more recent than the version below.';
-const AUTOSAVE_NOTICE_LOCAL = 'The backup of this post in your browser is different from the version below.';
+const AUTOSAVE_NOTICE_REMOTE =
+ 'There is an autosave of this post that is more recent than the version below.';
+const AUTOSAVE_NOTICE_LOCAL =
+ 'The backup of this post in your browser is different from the version below.';
async function saveDraftWithKeyboard() {
return pressKeyWithModifier( 'primary', 's' );
}
async function sleep( durationInSeconds ) {
- return new Promise( ( resolve ) =>
- setTimeout( resolve, durationInSeconds * 1000 ) );
+ return new Promise( ( resolve ) => setTimeout( resolve, durationInSeconds * 1000 ) );
}
async function clearSessionStorage() {
@@ -38,15 +39,12 @@ async function readSessionStorageAutosave( postId ) {
}
async function getCurrentPostId() {
- return page.evaluate(
- () => window.wp.data.select( 'core/editor' ).getCurrentPostId()
- );
+ return page.evaluate( () => window.wp.data.select( 'core/editor' ).getCurrentPostId() );
}
async function setLocalAutosaveInterval( value ) {
return page.evaluate( ( _value ) => {
- window.wp.data.dispatch( 'core/edit-post' )
- .__experimentalUpdateLocalAutosaveInterval( _value );
+ window.wp.data.dispatch( 'core/edit-post' ).__experimentalUpdateLocalAutosaveInterval( _value );
}, value );
}
@@ -86,7 +84,9 @@ describe( 'autosave', () => {
await sleep( 2 );
const newAutosave = await readSessionStorageAutosave( id );
- expect( JSON.parse( newAutosave ).content ).toBe( wrapParagraph( 'before save after save 123' ) );
+ expect( JSON.parse( newAutosave ).content ).toBe(
+ wrapParagraph( 'before save after save 123' )
+ );
} );
it( 'should recover from sessionStorage', async () => {
@@ -96,11 +96,16 @@ describe( 'autosave', () => {
await page.keyboard.type( ' after save' );
// Trigger local autosave
- await page.evaluate( () => window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave() );
+ await page.evaluate( () =>
+ window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave()
+ );
// Reload without saving on the server
await page.reload();
- const notice = await page.$eval( '.components-notice__content', ( element ) => element.innerText );
+ const notice = await page.$eval(
+ '.components-notice__content',
+ ( element ) => element.innerText
+ );
expect( notice ).toContain( AUTOSAVE_NOTICE_LOCAL );
expect( await getEditedPostContent() ).toEqual( wrapParagraph( 'before save' ) );
@@ -114,39 +119,49 @@ describe( 'autosave', () => {
await saveDraft();
// Fake local autosave
- await page.evaluate( ( postId ) => window.sessionStorage.setItem(
- `wp-autosave-block-editor-post-${ postId }`,
- JSON.stringify( { post_title: 'A', content: 'B', excerpt: 'C' } )
- ), await getCurrentPostId() );
+ await page.evaluate(
+ ( postId ) =>
+ window.sessionStorage.setItem(
+ `wp-autosave-block-editor-post-${ postId }`,
+ JSON.stringify( { post_title: 'A', content: 'B', excerpt: 'C' } )
+ ),
+ await getCurrentPostId()
+ );
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 1 );
await Promise.all( [
page.waitForSelector( '#wp-admin-bar-logout', { visible: true } ),
page.hover( '#wp-admin-bar-my-account' ),
] );
- await Promise.all( [
- page.waitForNavigation(),
- page.click( '#wp-admin-bar-logout' ),
- ] );
+ await Promise.all( [ page.waitForNavigation(), page.click( '#wp-admin-bar-logout' ) ] );
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 0 );
} );
- it( 'shouldn\'t contaminate other posts', async () => {
+ it( "shouldn't contaminate other posts", async () => {
await clickBlockAppender();
await page.keyboard.type( 'before save' );
await saveDraft();
// Fake local autosave
- await page.evaluate( ( postId ) => window.sessionStorage.setItem(
- `wp-autosave-block-editor-post-${ postId }`,
- JSON.stringify( { post_title: 'A', content: 'B', excerpt: 'C' } )
- ), await getCurrentPostId() );
+ await page.evaluate(
+ ( postId ) =>
+ window.sessionStorage.setItem(
+ `wp-autosave-block-editor-post-${ postId }`,
+ JSON.stringify( { post_title: 'A', content: 'B', excerpt: 'C' } )
+ ),
+ await getCurrentPostId()
+ );
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 1 );
await page.reload();
- const notice = await page.$eval( '.components-notice__content', ( element ) => element.innerText );
- expect( notice ).toContain( 'The backup of this post in your browser is different from the version below.' );
+ const notice = await page.$eval(
+ '.components-notice__content',
+ ( element ) => element.innerText
+ );
+ expect( notice ).toContain(
+ 'The backup of this post in your browser is different from the version below.'
+ );
await createNewPost();
expect( await page.$( '.components-notice__content' ) ).toBe( null );
@@ -160,7 +175,9 @@ describe( 'autosave', () => {
await page.keyboard.type( 'after save' );
// Trigger local autosave
- await page.evaluate( () => window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave() );
+ await page.evaluate( () =>
+ window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave()
+ );
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 1 );
// Trigger remote autosave
@@ -168,13 +185,15 @@ describe( 'autosave', () => {
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 0 );
} );
- it( 'shouldn\'t clear local autosave if remote autosave fails', async () => {
+ it( "shouldn't clear local autosave if remote autosave fails", async () => {
await clickBlockAppender();
await page.keyboard.type( 'before save' );
await saveDraft();
await page.keyboard.type( 'after save' );
- await page.evaluate( () => window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave() );
+ await page.evaluate( () =>
+ window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave()
+ );
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 1 );
toggleOfflineMode( true );
@@ -186,7 +205,7 @@ describe( 'autosave', () => {
toggleOfflineMode( false );
} );
- it( 'shouldn\'t conflict with server-side autosave', async () => {
+ it( "shouldn't conflict with server-side autosave", async () => {
await clickBlockAppender();
await page.keyboard.type( 'before publish' );
await publishPost();
@@ -198,7 +217,9 @@ describe( 'autosave', () => {
await page.evaluate( () => window.wp.data.dispatch( 'core/editor' ).autosave() );
// Force conflicting local autosave
- await page.evaluate( () => window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave() );
+ await page.evaluate( () =>
+ window.wp.data.dispatch( 'core/editor' ).__experimentalLocalAutosave()
+ );
expect( await page.evaluate( () => window.sessionStorage.length ) ).toBe( 1 );
await page.reload();
@@ -209,7 +230,9 @@ describe( 'autosave', () => {
// unrelated to *local* autosave, until we can understand them, we'll
// drop this test's expectations if we don't have an autosave object
// available.
- const stillHasRemoteAutosave = await page.evaluate( () => window.wp.data.select( 'core/editor' ).getEditorSettings().autosave );
+ const stillHasRemoteAutosave = await page.evaluate(
+ () => window.wp.data.select( 'core/editor' ).getEditorSettings().autosave
+ );
if ( ! stillHasRemoteAutosave ) {
return;
}
@@ -217,7 +240,10 @@ describe( 'autosave', () => {
// Only one autosave notice should be displayed.
const notices = await page.$$( '.components-notice' );
expect( notices.length ).toBe( 1 );
- const notice = await page.$eval( '.components-notice__content', ( element ) => element.innerText );
+ const notice = await page.$eval(
+ '.components-notice__content',
+ ( element ) => element.innerText
+ );
expect( notice ).toContain( AUTOSAVE_NOTICE_REMOTE );
} );
diff --git a/packages/e2e-tests/specs/editor/various/block-deletion.test.js b/packages/e2e-tests/specs/editor/various/block-deletion.test.js
index a231977ed171a6..fa5ce836d732f9 100644
--- a/packages/e2e-tests/specs/editor/various/block-deletion.test.js
+++ b/packages/e2e-tests/specs/editor/various/block-deletion.test.js
@@ -35,7 +35,10 @@ const clickOnBlockSettingsMenuRemoveBlockButton = async () => {
let isRemoveButton = false;
- let numButtons = await page.$$eval( '.block-editor-block-settings-menu__content button', ( btns ) => btns.length );
+ let numButtons = await page.$$eval(
+ '.block-editor-block-settings-menu__content button',
+ ( btns ) => btns.length
+ );
// Limit by the number of buttons available
while ( --numButtons ) {
diff --git a/packages/e2e-tests/specs/editor/various/block-grouping.test.js b/packages/e2e-tests/specs/editor/various/block-grouping.test.js
index 8d12894a6b3111..5e82e68a212adf 100644
--- a/packages/e2e-tests/specs/editor/various/block-grouping.test.js
+++ b/packages/e2e-tests/specs/editor/various/block-grouping.test.js
@@ -138,15 +138,15 @@ describe( 'Block Grouping', () => {
it( 'does not show group transform if Grouping block is disabled', async () => {
const availableTransforms = await getAvailableBlockTransforms();
- expect(
- availableTransforms
- ).not.toContain( 'Group' );
+ expect( availableTransforms ).not.toContain( 'Group' );
} );
it( 'does not show group option in the options toolbar if Grouping block is disabled ', async () => {
await clickBlockToolbarButton( 'More options' );
- const blockOptionsDropdownHTML = await page.evaluate( () => document.querySelector( '.block-editor-block-settings-menu__popover' ).innerHTML );
+ const blockOptionsDropdownHTML = await page.evaluate(
+ () => document.querySelector( '.block-editor-block-settings-menu__popover' ).innerHTML
+ );
expect( blockOptionsDropdownHTML ).not.toContain( 'Group' );
} );
diff --git a/packages/e2e-tests/specs/editor/various/block-hierarchy-navigation.test.js b/packages/e2e-tests/specs/editor/various/block-hierarchy-navigation.test.js
index 2dc5dc1f6cc544..83b79a4ba7b9d2 100644
--- a/packages/e2e-tests/specs/editor/various/block-hierarchy-navigation.test.js
+++ b/packages/e2e-tests/specs/editor/various/block-hierarchy-navigation.test.js
@@ -33,11 +33,15 @@ describe( 'Navigating the block hierarchy', () => {
// Navigate to the columns blocks.
await page.click( '[aria-label="Block navigation"]' );
- const columnsBlockMenuItem = ( await page.$x( "//button[contains(@class,'block-editor-block-navigation__item') and contains(text(), 'Columns')]" ) )[ 0 ];
+ const columnsBlockMenuItem = ( await page.$x(
+ "//button[contains(@class,'block-editor-block-navigation__item') and contains(text(), 'Columns')]"
+ ) )[ 0 ];
await columnsBlockMenuItem.click();
// Tweak the columns count.
- await page.focus( '.block-editor-block-inspector .components-range-control__number[aria-label="Columns"]' );
+ await page.focus(
+ '.block-editor-block-inspector .components-range-control__number[aria-label="Columns"]'
+ );
await page.keyboard.down( 'Shift' );
await page.keyboard.press( 'ArrowLeft' );
await page.keyboard.up( 'Shift' );
diff --git a/packages/e2e-tests/specs/editor/various/block-switcher.test.js b/packages/e2e-tests/specs/editor/various/block-switcher.test.js
index 9282e83dc855f1..e9098ce6b03cf9 100644
--- a/packages/e2e-tests/specs/editor/various/block-switcher.test.js
+++ b/packages/e2e-tests/specs/editor/various/block-switcher.test.js
@@ -24,13 +24,7 @@ describe( 'adding blocks', () => {
expect( await hasBlockSwitcher() ).toBeTruthy();
// Verify the correct block transforms appear.
- expect(
- await getAvailableBlockTransforms()
- ).toEqual( [
- 'Group',
- 'Paragraph',
- 'Quote',
- ] );
+ expect( await getAvailableBlockTransforms() ).toEqual( [ 'Group', 'Paragraph', 'Quote' ] );
} );
it( 'Should show the expected block transforms on the list block when the quote block is removed', async () => {
@@ -48,22 +42,15 @@ describe( 'adding blocks', () => {
expect( await hasBlockSwitcher() ).toBeTruthy();
// Verify the correct block transforms appear.
- expect(
- await getAvailableBlockTransforms()
- ).toEqual( [
- 'Group',
- 'Paragraph',
- ] );
+ expect( await getAvailableBlockTransforms() ).toEqual( [ 'Group', 'Paragraph' ] );
} );
it( 'Should not show the block switcher if all the blocks the list block transforms into are removed', async () => {
// Remove the paragraph and quote block from the list of registered blocks.
await page.evaluate( () => {
- ( [
- 'core/quote',
- 'core/paragraph',
- 'core/group',
- ] ).map( ( block ) => wp.blocks.unregisterBlockType( block ) );
+ [ 'core/quote', 'core/paragraph', 'core/group' ].map( ( block ) =>
+ wp.blocks.unregisterBlockType( block )
+ );
} );
// Insert a list block.
@@ -74,8 +61,6 @@ describe( 'adding blocks', () => {
// Verify the block switcher exists.
expect( await hasBlockSwitcher() ).toBeFalsy();
// Verify the correct block transforms appear.
- expect(
- await getAvailableBlockTransforms()
- ).toHaveLength( 0 );
+ expect( await getAvailableBlockTransforms() ).toHaveLength( 0 );
} );
} );
diff --git a/packages/e2e-tests/specs/editor/various/change-detection.test.js b/packages/e2e-tests/specs/editor/various/change-detection.test.js
index 0f384d7c3efd5a..4a952bb90d7e3a 100644
--- a/packages/e2e-tests/specs/editor/various/change-detection.test.js
+++ b/packages/e2e-tests/specs/editor/various/change-detection.test.js
@@ -93,7 +93,9 @@ describe( 'Change detection', () => {
// Toggle post as needing review (not persisted for autosave).
await ensureSidebarOpened();
- const postPendingReviewButton = ( await page.$x( "//label[contains(text(), 'Pending Review')]" ) )[ 0 ];
+ const postPendingReviewButton = ( await page.$x(
+ "//label[contains(text(), 'Pending Review')]"
+ ) )[ 0 ];
await postPendingReviewButton.click( 'button' );
// Force autosave to occur immediately.
@@ -225,7 +227,9 @@ describe( 'Change detection', () => {
await assertIsDirty( true );
- expect( console ).toHaveErroredWith( 'Failed to load resource: net::ERR_INTERNET_DISCONNECTED' );
+ expect( console ).toHaveErroredWith(
+ 'Failed to load resource: net::ERR_INTERNET_DISCONNECTED'
+ );
} );
it( 'Should prompt if changes and save is in-flight', async () => {
@@ -319,7 +323,9 @@ describe( 'Change detection', () => {
// long as the experimental reusable blocks fetching data flow exists.
//
// See: https://github.com/WordPress/gutenberg/issues/14766
- await page.evaluate( () => window.wp.data.dispatch( 'core/editor' ).__experimentalReceiveReusableBlocks( [] ) );
+ await page.evaluate( () =>
+ window.wp.data.dispatch( 'core/editor' ).__experimentalReceiveReusableBlocks( [] )
+ );
await assertIsDirty( false );
} );
@@ -339,10 +345,7 @@ describe( 'Change detection', () => {
] );
// Verify that the title is empty.
- const title = await page.$eval(
- '.editor-post-title__input',
- ( element ) => element.innerHTML
- );
+ const title = await page.$eval( '.editor-post-title__input', ( element ) => element.innerHTML );
expect( title ).toBe( '' );
// Verify that the post is not dirty.
diff --git a/packages/e2e-tests/specs/editor/various/editor-modes.test.js b/packages/e2e-tests/specs/editor/various/editor-modes.test.js
index 3969ac43f80fc7..0f76d8ca990afe 100644
--- a/packages/e2e-tests/specs/editor/various/editor-modes.test.js
+++ b/packages/e2e-tests/specs/editor/various/editor-modes.test.js
@@ -17,7 +17,9 @@ describe( 'Editing modes (visual/HTML)', () => {
it( 'should switch between visual and HTML modes', async () => {
// This block should be in "visual" mode by default.
- let visualBlock = await page.$$( '.block-editor-block-list__layout .block-editor-block-list__block .rich-text' );
+ let visualBlock = await page.$$(
+ '.block-editor-block-list__layout .block-editor-block-list__block .rich-text'
+ );
expect( visualBlock ).toHaveLength( 1 );
// Move the mouse to show the block toolbar
@@ -30,7 +32,9 @@ describe( 'Editing modes (visual/HTML)', () => {
await changeModeButton.click();
// Wait for the block to be converted to HTML editing mode.
- const htmlBlock = await page.$$( '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea' );
+ const htmlBlock = await page.$$(
+ '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea'
+ );
expect( htmlBlock ).toHaveLength( 1 );
// Move the mouse to show the block toolbar
@@ -43,7 +47,9 @@ describe( 'Editing modes (visual/HTML)', () => {
await changeModeButton.click();
// This block should be in "visual" mode by default.
- visualBlock = await page.$$( '.block-editor-block-list__layout .block-editor-block-list__block .rich-text' );
+ visualBlock = await page.$$(
+ '.block-editor-block-list__layout .block-editor-block-list__block .rich-text'
+ );
expect( visualBlock ).toHaveLength( 1 );
} );
@@ -59,7 +65,9 @@ describe( 'Editing modes (visual/HTML)', () => {
// The font size picker for the paragraph block should appear, even in
// HTML editing mode.
- const fontSizePicker = await page.$$( '.edit-post-sidebar .components-font-size-picker__controls' );
+ const fontSizePicker = await page.$$(
+ '.edit-post-sidebar .components-font-size-picker__controls'
+ );
expect( fontSizePicker ).toHaveLength( 1 );
} );
@@ -74,14 +82,23 @@ describe( 'Editing modes (visual/HTML)', () => {
await changeModeButton.click();
// Make sure the paragraph content is rendered as expected.
- let htmlBlockContent = await page.$eval( '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea', ( node ) => node.textContent );
+ let htmlBlockContent = await page.$eval(
+ '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea',
+ ( node ) => node.textContent
+ );
expect( htmlBlockContent ).toEqual( '
Hello world!
' );
// Change the font size using the sidebar.
- await page.select( '.components-font-size-picker__select .components-select-control__input', 'large' );
+ await page.select(
+ '.components-font-size-picker__select .components-select-control__input',
+ 'large'
+ );
// Make sure the HTML content updated.
- htmlBlockContent = await page.$eval( '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea', ( node ) => node.textContent );
+ htmlBlockContent = await page.$eval(
+ '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea',
+ ( node ) => node.textContent
+ );
expect( htmlBlockContent ).toEqual( 'Hello world!
' );
} );
@@ -94,13 +111,17 @@ describe( 'Editing modes (visual/HTML)', () => {
expect( title ).toBe( 'Paragraph' );
// The Block inspector should be active
- let blockInspectorTab = await page.$( '.edit-post-sidebar__panel-tab.is-active[data-label="Block"]' );
+ let blockInspectorTab = await page.$(
+ '.edit-post-sidebar__panel-tab.is-active[data-label="Block"]'
+ );
expect( blockInspectorTab ).not.toBeNull();
await switchEditorModeTo( 'Code' );
// The Block inspector should not be active anymore
- blockInspectorTab = await page.$( '.edit-post-sidebar__panel-tab.is-active[data-label="Block"]' );
+ blockInspectorTab = await page.$(
+ '.edit-post-sidebar__panel-tab.is-active[data-label="Block"]'
+ );
expect( blockInspectorTab ).toBeNull();
// No block is selected
diff --git a/packages/e2e-tests/specs/editor/various/embedding.test.js b/packages/e2e-tests/specs/editor/various/embedding.test.js
index 0a986702075bec..dcb1c06d0cb89a 100644
--- a/packages/e2e-tests/specs/editor/various/embedding.test.js
+++ b/packages/e2e-tests/specs/editor/various/embedding.test.js
@@ -68,7 +68,8 @@ const MOCK_BAD_EMBED_PROVIDER_RESPONSE = {
const MOCK_CANT_EMBED_RESPONSE = {
provider_name: 'Embed Handler',
- html: 'https://twitter.com/wooyaygutenberg123454312',
+ html:
+ 'https://twitter.com/wooyaygutenberg123454312',
};
const MOCK_BAD_WORDPRESS_RESPONSE = {
@@ -90,7 +91,9 @@ const MOCK_RESPONSES = [
onRequestMatch: createJSONResponse( MOCK_BAD_WORDPRESS_RESPONSE ),
},
{
- match: createEmbeddingMatcher( 'https://wordpress.org/gutenberg/handbook/block-api/attributes/' ),
+ match: createEmbeddingMatcher(
+ 'https://wordpress.org/gutenberg/handbook/block-api/attributes/'
+ ),
onRequestMatch: createJSONResponse( MOCK_EMBED_WORDPRESS_SUCCESS_RESPONSE ),
},
{
@@ -237,14 +240,12 @@ describe( 'Embedding content', () => {
await page.keyboard.type( 'https://twitter.com/wooyaygutenberg123454312' );
await page.keyboard.press( 'Enter' );
// Set up a different mock to make sure that try again actually does make the request again.
- await setUpResponseMocking(
- [
- {
- match: createEmbeddingMatcher( 'https://twitter.com/wooyaygutenberg123454312' ),
- onRequestMatch: createJSONResponse( MOCK_EMBED_RICH_SUCCESS_RESPONSE ),
- },
- ]
- );
+ await setUpResponseMocking( [
+ {
+ match: createEmbeddingMatcher( 'https://twitter.com/wooyaygutenberg123454312' ),
+ onRequestMatch: createJSONResponse( MOCK_EMBED_RICH_SUCCESS_RESPONSE ),
+ },
+ ] );
await clickButton( 'Try again' );
await page.waitForSelector( 'figure.wp-block-embed-twitter' );
} );
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 0fb98caa4f5d29..9b47eb36f7ee2e 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
@@ -17,7 +17,10 @@ describe( 'Font Size Picker', () => {
// Create a paragraph block with some content.
await clickBlockAppender();
await page.keyboard.type( 'Paragraph to be made "large"' );
- await page.select( '.components-font-size-picker__select .components-select-control__input', 'large' );
+ await page.select(
+ '.components-font-size-picker__select .components-select-control__input',
+ 'large'
+ );
// Ensure content matches snapshot.
const content = await getEditedPostContent();
@@ -56,9 +59,14 @@ describe( 'Font Size Picker', () => {
await clickBlockAppender();
await page.keyboard.type( 'Paragraph with font size reset using button' );
- await page.select( '.components-font-size-picker__select .components-select-control__input', 'normal' );
+ await page.select(
+ '.components-font-size-picker__select .components-select-control__input',
+ 'normal'
+ );
- const resetButton = ( await page.$x( '//*[contains(concat(" ", @class, " "), " components-font-size-picker__controls ")]//*[text()=\'Reset\']' ) )[ 0 ];
+ const resetButton = ( await page.$x(
+ '//*[contains(concat(" ", @class, " "), " components-font-size-picker__controls ")]//*[text()=\'Reset\']'
+ ) )[ 0 ];
await resetButton.click();
// Ensure content matches snapshot.
@@ -71,7 +79,10 @@ describe( 'Font Size Picker', () => {
await clickBlockAppender();
await page.keyboard.type( 'Paragraph with font size reset using input field' );
- await page.select( '.components-font-size-picker__select .components-select-control__input', 'large' );
+ await page.select(
+ '.components-font-size-picker__select .components-select-control__input',
+ 'large'
+ );
// Clear the custom font size input.
await page.click( '.blocks-font-size .components-range-control__number' );
diff --git a/packages/e2e-tests/specs/editor/various/fullscreen-mode.test.js b/packages/e2e-tests/specs/editor/various/fullscreen-mode.test.js
index 9936fd1e48a52c..faf1a417b32ce7 100644
--- a/packages/e2e-tests/specs/editor/various/fullscreen-mode.test.js
+++ b/packages/e2e-tests/specs/editor/various/fullscreen-mode.test.js
@@ -1,11 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- createNewPost,
- clickOnMoreMenuItem,
- toggleMoreMenu,
-} from '@wordpress/e2e-test-utils';
+import { createNewPost, clickOnMoreMenuItem, toggleMoreMenu } from '@wordpress/e2e-test-utils';
describe( 'Fullscreen Mode', () => {
beforeAll( async () => {
diff --git a/packages/e2e-tests/specs/editor/various/invalid-block.test.js b/packages/e2e-tests/specs/editor/various/invalid-block.test.js
index d0d8dda5a805d6..42110521060c38 100644
--- a/packages/e2e-tests/specs/editor/various/invalid-block.test.js
+++ b/packages/e2e-tests/specs/editor/various/invalid-block.test.js
@@ -24,7 +24,9 @@ describe( 'invalid blocks', () => {
await changeModeButton.click();
// Focus on the textarea and enter an invalid paragraph
- await page.click( '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea' );
+ await page.click(
+ '.block-editor-block-list__layout .block-editor-block-list__block .block-editor-block-list__block-html-textarea'
+ );
await page.keyboard.type( 'invalid paragraph' );
// Takes the focus away from the block so the invalid warning is triggered
@@ -36,7 +38,10 @@ describe( 'invalid blocks', () => {
await page.click( '.block-editor-warning__actions button' );
// Check we get the resolve modal with the appropriate contents
- const htmlBlockContent = await page.$eval( '.block-editor-block-compare__html', ( node ) => node.textContent );
+ const htmlBlockContent = await page.$eval(
+ '.block-editor-block-compare__html',
+ ( node ) => node.textContent
+ );
expect( htmlBlockContent ).toEqual( '
hello
invalid paragraph' );
} );
} );
diff --git a/packages/e2e-tests/specs/editor/various/keyboard-navigable-blocks.test.js b/packages/e2e-tests/specs/editor/various/keyboard-navigable-blocks.test.js
index a8ebe96c34fcd2..494d318685b9ca 100644
--- a/packages/e2e-tests/specs/editor/various/keyboard-navigable-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/various/keyboard-navigable-blocks.test.js
@@ -1,11 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- createNewPost,
- insertBlock,
- pressKeyWithModifier,
-} from '@wordpress/e2e-test-utils';
+import { createNewPost, insertBlock, pressKeyWithModifier } from '@wordpress/e2e-test-utils';
const navigateToContentEditorTop = async () => {
// Use 'Ctrl+`' to return to the top of the editor
@@ -21,9 +17,7 @@ const tabThroughParagraphBlock = async ( paragraphText ) => {
await page.keyboard.press( 'Tab' );
// The block external focusable wrapper has focus
- const isFocusedParagraphBlock = await page.evaluate(
- () => document.activeElement.dataset.type
- );
+ const isFocusedParagraphBlock = await page.evaluate( () => document.activeElement.dataset.type );
await expect( isFocusedParagraphBlock ).toEqual( 'core/paragraph' );
// Tab causes 'add block' button to receive focus
@@ -44,9 +38,7 @@ const tabThroughParagraphBlock = async ( paragraphText ) => {
// The value of 'contentEditable' should be the string 'true'
await expect( isFocusedParagraphContent ).toBe( 'true' );
- const paragraphEditableContent = await page.evaluate(
- () => document.activeElement.innerHTML
- );
+ const paragraphEditableContent = await page.evaluate( () => document.activeElement.innerHTML );
await expect( paragraphEditableContent ).toBe( paragraphText );
};
@@ -70,9 +62,7 @@ const tabThroughBlockToolbar = async () => {
// Tab to focus on the 'block switcher' control
await page.keyboard.press( 'Tab' );
const isFocusedBlockSwitcherControl = await page.evaluate( () =>
- document.activeElement.classList.contains(
- 'block-editor-block-switcher__toggle'
- )
+ document.activeElement.classList.contains( 'block-editor-block-switcher__toggle' )
);
await expect( isFocusedBlockSwitcherControl ).toBe( true );
diff --git a/packages/e2e-tests/specs/editor/various/links.test.js b/packages/e2e-tests/specs/editor/various/links.test.js
index ce9aaeab186799..76c623bd956b16 100644
--- a/packages/e2e-tests/specs/editor/various/links.test.js
+++ b/packages/e2e-tests/specs/editor/various/links.test.js
@@ -22,7 +22,9 @@ describe( 'Links', () => {
} );
const waitForAutoFocus = async () => {
- await page.waitForFunction( () => !! document.activeElement.closest( '.block-editor-url-input' ) );
+ await page.waitForFunction(
+ () => !! document.activeElement.closest( '.block-editor-url-input' )
+ );
};
it( 'can be created by selecting text and clicking Link', async () => {
@@ -263,7 +265,9 @@ describe( 'Links', () => {
// Return the URL of the new post
await page.waitForSelector( '.post-publish-panel__postpublish-post-address input' );
- return page.evaluate( () => document.querySelector( '.post-publish-panel__postpublish-post-address input' ).value );
+ return page.evaluate(
+ () => document.querySelector( '.post-publish-panel__postpublish-post-address input' ).value
+ );
};
it( 'allows use of escape key to dismiss the url popover', async () => {
@@ -346,7 +350,9 @@ describe( 'Links', () => {
// focused with the value previously inserted.
await pressKeyWithModifier( 'primary', 'K' );
await waitForAutoFocus();
- const activeElementParentClasses = await page.evaluate( () => Object.values( document.activeElement.parentElement.classList ) );
+ const activeElementParentClasses = await page.evaluate( () =>
+ Object.values( document.activeElement.parentElement.classList )
+ );
expect( activeElementParentClasses ).toContain( 'block-editor-url-input' );
const activeElementValue = await page.evaluate( () => document.activeElement.value );
expect( activeElementValue ).toBe( URL );
@@ -360,8 +366,12 @@ describe( 'Links', () => {
await waitForAutoFocus();
await page.keyboard.type( 'http://#test.com' );
await page.keyboard.press( 'Enter' );
- const assertiveContent = await page.evaluate( () => document.querySelector( '#a11y-speak-assertive' ).textContent );
- expect( assertiveContent.trim() ).toBe( 'Warning: the link has been inserted but may have errors. Please test it.' );
+ const assertiveContent = await page.evaluate(
+ () => document.querySelector( '#a11y-speak-assertive' ).textContent
+ );
+ expect( assertiveContent.trim() ).toBe(
+ 'Warning: the link has been inserted but may have errors. Please test it.'
+ );
} );
it( 'link popover remains visible after a mouse drag event', async () => {
@@ -392,7 +402,7 @@ describe( 'Links', () => {
await page.mouse.move( bounds.x, bounds.y );
await page.mouse.down();
- await page.mouse.move( bounds.x + ( bounds.width / 2 ), bounds.y, { steps: 10 } );
+ await page.mouse.move( bounds.x + bounds.width / 2, bounds.y, { steps: 10 } );
await page.mouse.up();
// The link popover should still be visible
diff --git a/packages/e2e-tests/specs/editor/various/manage-reusable-blocks.test.js b/packages/e2e-tests/specs/editor/various/manage-reusable-blocks.test.js
index 9d17922f519f39..54da2b78a9ad4c 100644
--- a/packages/e2e-tests/specs/editor/various/manage-reusable-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/various/manage-reusable-blocks.test.js
@@ -32,7 +32,14 @@ describe( 'Managing reusable blocks', () => {
await importButton.click();
// Select the file to upload
- const testReusableBlockFile = path.join( __dirname, '..', '..', '..', 'assets', 'greeting-reusable-block.json' );
+ const testReusableBlockFile = path.join(
+ __dirname,
+ '..',
+ '..',
+ '..',
+ 'assets',
+ 'greeting-reusable-block.json'
+ );
const input = await page.$( '.list-reusable-blocks-import-form input' );
await input.uploadFile( testReusableBlockFile );
diff --git a/packages/e2e-tests/specs/editor/various/mentions.test.js b/packages/e2e-tests/specs/editor/various/mentions.test.js
index 2d2f220bc47402..d7f28a18fec8f9 100644
--- a/packages/e2e-tests/specs/editor/various/mentions.test.js
+++ b/packages/e2e-tests/specs/editor/various/mentions.test.js
@@ -1,11 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- createNewPost,
- getEditedPostContent,
- clickBlockAppender,
-} from '@wordpress/e2e-test-utils';
+import { createNewPost, getEditedPostContent, clickBlockAppender } from '@wordpress/e2e-test-utils';
describe( 'autocomplete mentions', () => {
beforeAll( async () => {
diff --git a/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js b/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js
index 6bf7a62bf7789e..ebece9ddf8dccc 100644
--- a/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js
+++ b/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js
@@ -136,7 +136,10 @@ describe( 'Multi-block selection', () => {
// DOM-dependant side-effect setup code and doesn't seem straightforward
// to mock. Instead, we check for the DOM node that `wp.a11y.speak()`
// inserts text into.
- const speakTextContent = await page.$eval( '#a11y-speak-assertive', ( element ) => element.textContent );
+ const speakTextContent = await page.$eval(
+ '#a11y-speak-assertive',
+ ( element ) => element.textContent
+ );
expect( speakTextContent.trim() ).toEqual( '3 blocks selected.' );
} );
diff --git a/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js b/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js
index 1b8efda52e1bb9..1346becf1d009a 100644
--- a/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js
+++ b/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js
@@ -18,14 +18,15 @@ describe.each( [ [ 'unified', true ], [ 'contextual', false ] ] )(
}, isUnifiedToolbar );
} );
- const isInBlockToolbar = () => page.evaluate( ( _isUnifiedToolbar ) => {
- if ( _isUnifiedToolbar ) {
- return !! document.activeElement
- .closest( '.edit-post-header-toolbar' )
- .querySelector( '.block-editor-block-toolbar' );
- }
- return !! document.activeElement.closest( '.block-editor-block-toolbar' );
- }, isUnifiedToolbar );
+ const isInBlockToolbar = () =>
+ page.evaluate( ( _isUnifiedToolbar ) => {
+ if ( _isUnifiedToolbar ) {
+ return !! document.activeElement
+ .closest( '.edit-post-header-toolbar' )
+ .querySelector( '.block-editor-block-toolbar' );
+ }
+ return !! document.activeElement.closest( '.block-editor-block-toolbar' );
+ }, isUnifiedToolbar );
it( 'navigates in and out of toolbar by keyboard (Alt+F10, Escape)', async () => {
// Assumes new post focus starts in title. Create first new
@@ -42,4 +43,3 @@ describe.each( [ [ 'unified', true ], [ 'contextual', false ] ] )(
} );
}
);
-
diff --git a/packages/e2e-tests/specs/editor/various/new-post-default-content.test.js b/packages/e2e-tests/specs/editor/various/new-post-default-content.test.js
index 3fdad97d46f64e..6573d81447ccf7 100644
--- a/packages/e2e-tests/specs/editor/various/new-post-default-content.test.js
+++ b/packages/e2e-tests/specs/editor/various/new-post-default-content.test.js
@@ -25,10 +25,7 @@ describe( 'new editor filtered state', () => {
it( 'should respect default content', async () => {
// get the values that should have their defaults changed.
- const title = await page.$eval(
- '.editor-post-title__input',
- ( element ) => element.innerHTML
- );
+ const title = await page.$eval( '.editor-post-title__input', ( element ) => element.innerHTML );
const content = await getEditedPostContent();
// open the sidebar, we want to see the excerpt.
diff --git a/packages/e2e-tests/specs/editor/various/new-post.test.js b/packages/e2e-tests/specs/editor/various/new-post.test.js
index c4cb3fa082dcad..f4416833b6588c 100644
--- a/packages/e2e-tests/specs/editor/various/new-post.test.js
+++ b/packages/e2e-tests/specs/editor/various/new-post.test.js
@@ -1,11 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- activatePlugin,
- createNewPost,
- deactivatePlugin,
-} from '@wordpress/e2e-test-utils';
+import { activatePlugin, createNewPost, deactivatePlugin } from '@wordpress/e2e-test-utils';
describe( 'new editor state', () => {
beforeAll( async () => {
diff --git a/packages/e2e-tests/specs/editor/various/nux.test.js b/packages/e2e-tests/specs/editor/various/nux.test.js
index d3ca54af511763..e50e8a240bdd6a 100644
--- a/packages/e2e-tests/specs/editor/various/nux.test.js
+++ b/packages/e2e-tests/specs/editor/various/nux.test.js
@@ -1,10 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- createNewPost,
- toggleScreenOption,
-} from '@wordpress/e2e-test-utils';
+import { createNewPost, toggleScreenOption } from '@wordpress/e2e-test-utils';
describe( 'New User Experience (NUX)', () => {
async function clickAllTips( page ) {
@@ -43,7 +40,9 @@ describe( 'New User Experience (NUX)', () => {
await nextTipButton.click();
const secondTipText = await page.$eval( '.nux-dot-tip', ( element ) => element.innerText );
- expect( secondTipText ).toContain( 'You’ll find more settings for your page and blocks in the sidebar.' );
+ expect( secondTipText ).toContain(
+ 'You’ll find more settings for your page and blocks in the sidebar.'
+ );
} );
it( 'should show "Got it" once all tips have been displayed', async () => {
diff --git a/packages/e2e-tests/specs/editor/various/popovers.test.js b/packages/e2e-tests/specs/editor/various/popovers.test.js
index 5a1e17817dabff..526cf05f5ef3fd 100644
--- a/packages/e2e-tests/specs/editor/various/popovers.test.js
+++ b/packages/e2e-tests/specs/editor/various/popovers.test.js
@@ -10,7 +10,7 @@ describe( 'popovers', () => {
describe( 'dropdown', () => {
it( 'toggles via click', async () => {
- const isMoreMenuOpen = async () => !! await page.$( '.edit-post-more-menu__content' );
+ const isMoreMenuOpen = async () => !! ( await page.$( '.edit-post-more-menu__content' ) );
expect( await isMoreMenuOpen() ).toBe( false );
diff --git a/packages/e2e-tests/specs/editor/various/preview.test.js b/packages/e2e-tests/specs/editor/various/preview.test.js
index 505f8cca3ba3a4..1db3b7cb8b8a1c 100644
--- a/packages/e2e-tests/specs/editor/various/preview.test.js
+++ b/packages/e2e-tests/specs/editor/various/preview.test.js
@@ -60,19 +60,19 @@ async function waitForPreviewNavigation( previewPage ) {
* @param {boolean} shouldBeChecked If true, turns the option on. If false, off.
*/
async function toggleCustomFieldsOption( shouldBeChecked ) {
- const checkboxXPath = '//*[contains(@class, "edit-post-options-modal")]//label[contains(text(), "Custom Fields")]';
+ const checkboxXPath =
+ '//*[contains(@class, "edit-post-options-modal")]//label[contains(text(), "Custom Fields")]';
await clickOnMoreMenuItem( 'Options' );
await page.waitForXPath( checkboxXPath );
const [ checkboxHandle ] = await page.$x( checkboxXPath );
- const isChecked = await page.evaluate(
- ( element ) => element.control.checked,
- checkboxHandle
- );
+ const isChecked = await page.evaluate( ( element ) => element.control.checked, checkboxHandle );
if ( isChecked !== shouldBeChecked ) {
await checkboxHandle.click();
- const [ saveButton ] = await page.$x( shouldBeChecked ? '//button[text()="Enable & Reload"]' : '//button[text()="Disable & Reload"]' );
+ const [ saveButton ] = await page.$x(
+ shouldBeChecked ? '//button[text()="Enable & Reload"]' : '//button[text()="Disable & Reload"]'
+ );
const navigationCompleted = page.waitForNavigation();
saveButton.click();
await navigationCompleted;
@@ -93,7 +93,7 @@ describe( 'Preview', () => {
// Disabled until content present.
const isPreviewDisabled = await editorPage.$$eval(
'.editor-post-preview:not( :disabled )',
- ( enabledButtons ) => ! enabledButtons.length,
+ ( enabledButtons ) => ! enabledButtons.length
);
expect( isPreviewDisabled ).toBe( true );
@@ -233,7 +233,10 @@ describe( 'Preview with Custom Fields enabled', () => {
// Check the title and preview match.
let previewTitle = await previewPage.$eval( '.entry-title', ( node ) => node.textContent );
expect( previewTitle ).toBe( 'title 1' );
- let previewContent = await previewPage.$eval( '.entry-content p', ( node ) => node.textContent );
+ let previewContent = await previewPage.$eval(
+ '.entry-content p',
+ ( node ) => node.textContent
+ );
expect( previewContent ).toBe( 'content 1' );
// Return to editor and modify the title and content.
diff --git a/packages/e2e-tests/specs/editor/various/publish-button.test.js b/packages/e2e-tests/specs/editor/various/publish-button.test.js
index ecdd6bf76b0005..6245f791c60dc5 100644
--- a/packages/e2e-tests/specs/editor/various/publish-button.test.js
+++ b/packages/e2e-tests/specs/editor/various/publish-button.test.js
@@ -11,7 +11,7 @@ import {
describe( 'PostPublishButton', () => {
let werePrePublishChecksEnabled;
beforeEach( async () => {
- await createNewPost( );
+ await createNewPost();
werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
if ( werePrePublishChecksEnabled ) {
await disablePrePublishChecks();
@@ -41,7 +41,9 @@ describe( 'PostPublishButton', () => {
await page.type( '.editor-post-title__input', 'E2E Test Post' ); // Make it saveable
expect( await page.$( '.editor-post-publish-button[aria-disabled="true"]' ) ).toBeNull();
- await page.evaluate( () => window.wp.data.dispatch( 'core/edit-post' ).requestMetaBoxUpdates() );
+ await page.evaluate( () =>
+ window.wp.data.dispatch( 'core/edit-post' ).requestMetaBoxUpdates()
+ );
expect( await page.$( '.editor-post-publish-button[aria-disabled="true"]' ) ).not.toBeNull();
} );
} );
diff --git a/packages/e2e-tests/specs/editor/various/publish-panel.test.js b/packages/e2e-tests/specs/editor/various/publish-panel.test.js
index c28a3837d74438..fab18cc4d8b533 100644
--- a/packages/e2e-tests/specs/editor/various/publish-panel.test.js
+++ b/packages/e2e-tests/specs/editor/various/publish-panel.test.js
@@ -14,7 +14,7 @@ import {
describe( 'PostPublishPanel', () => {
let werePrePublishChecksEnabled;
beforeEach( async () => {
- await createNewPost( );
+ await createNewPost();
werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
if ( ! werePrePublishChecksEnabled ) {
await enablePrePublishChecks();
diff --git a/packages/e2e-tests/specs/editor/various/publishing.test.js b/packages/e2e-tests/specs/editor/various/publishing.test.js
index 64b8705ef8bab0..674ac3031c8848 100644
--- a/packages/e2e-tests/specs/editor/various/publishing.test.js
+++ b/packages/e2e-tests/specs/editor/various/publishing.test.js
@@ -12,101 +12,92 @@ import {
} from '@wordpress/e2e-test-utils';
describe( 'Publishing', () => {
- describe.each( [ 'post', 'page' ] )(
- 'a %s',
- ( postType ) => {
- let werePrePublishChecksEnabled;
-
- beforeEach( async () => {
- await createNewPost( postType );
- werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
- if ( ! werePrePublishChecksEnabled ) {
- await enablePrePublishChecks();
- }
- } );
-
- afterEach( async () => {
- if ( ! werePrePublishChecksEnabled ) {
- await disablePrePublishChecks();
- }
- } );
-
- it( `should publish the ${ postType } and close the panel once we start editing again.`, async () => {
- await page.type( '.editor-post-title__input', 'E2E Test Post' );
-
- await publishPost();
-
- // The post-publishing panel is visible.
- expect( await page.$( '.editor-post-publish-panel' ) ).not.toBeNull();
-
- // Start editing again.
- await page.type( '.editor-post-title__input', ' (Updated)' );
-
- // The post-publishing panel is not visible anymore.
- expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
- } );
- }
- );
-
- describe.each( [ 'post', 'page' ] )(
- 'a %s with pre-publish checks disabled',
- ( postType ) => {
- let werePrePublishChecksEnabled;
-
- beforeEach( async () => {
- await createNewPost( postType );
- werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
- if ( werePrePublishChecksEnabled ) {
- await disablePrePublishChecks();
- }
- } );
-
- afterEach( async () => {
- if ( werePrePublishChecksEnabled ) {
- await enablePrePublishChecks();
- }
- } );
-
- it( `should publish the ${ postType } without opening the post-publish sidebar.`, async () => {
- await page.type( '.editor-post-title__input', 'E2E Test Post' );
-
- // The "Publish" button should be shown instead of the "Publish..." toggle
- expect( await page.$( '.editor-post-publish-panel__toggle' ) ).toBeNull();
- expect( await page.$( '.editor-post-publish-button' ) ).not.toBeNull();
-
- await publishPostWithPrePublishChecksDisabled();
-
- // The post-publishing panel should have been not shown.
- expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
- } );
- }
- );
-
- describe.each( [ 'post', 'page' ] )(
- 'a %s in small viewports',
- ( postType ) => {
- let werePrePublishChecksEnabled;
-
- beforeEach( async () => {
- await createNewPost( postType );
- werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
- if ( werePrePublishChecksEnabled ) {
- await disablePrePublishChecks();
- }
- await setBrowserViewport( 'small' );
- } );
-
- afterEach( async () => {
- await setBrowserViewport( 'large' );
- if ( werePrePublishChecksEnabled ) {
- await enablePrePublishChecks();
- }
- } );
-
- it( `should ignore the pre-publish checks and show the Publish... toggle instead of the Publish button`, async () => {
- expect( await page.$( '.editor-post-publish-panel__toggle' ) ).not.toBeNull();
- expect( await page.$( '.editor-post-publish-button' ) ).toBeNull();
- } );
- }
- );
+ describe.each( [ 'post', 'page' ] )( 'a %s', ( postType ) => {
+ let werePrePublishChecksEnabled;
+
+ beforeEach( async () => {
+ await createNewPost( postType );
+ werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
+ if ( ! werePrePublishChecksEnabled ) {
+ await enablePrePublishChecks();
+ }
+ } );
+
+ afterEach( async () => {
+ if ( ! werePrePublishChecksEnabled ) {
+ await disablePrePublishChecks();
+ }
+ } );
+
+ it( `should publish the ${ postType } and close the panel once we start editing again.`, async () => {
+ await page.type( '.editor-post-title__input', 'E2E Test Post' );
+
+ await publishPost();
+
+ // The post-publishing panel is visible.
+ expect( await page.$( '.editor-post-publish-panel' ) ).not.toBeNull();
+
+ // Start editing again.
+ await page.type( '.editor-post-title__input', ' (Updated)' );
+
+ // The post-publishing panel is not visible anymore.
+ expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
+ } );
+ } );
+
+ describe.each( [ 'post', 'page' ] )( 'a %s with pre-publish checks disabled', ( postType ) => {
+ let werePrePublishChecksEnabled;
+
+ beforeEach( async () => {
+ await createNewPost( postType );
+ werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
+ if ( werePrePublishChecksEnabled ) {
+ await disablePrePublishChecks();
+ }
+ } );
+
+ afterEach( async () => {
+ if ( werePrePublishChecksEnabled ) {
+ await enablePrePublishChecks();
+ }
+ } );
+
+ it( `should publish the ${ postType } without opening the post-publish sidebar.`, async () => {
+ await page.type( '.editor-post-title__input', 'E2E Test Post' );
+
+ // The "Publish" button should be shown instead of the "Publish..." toggle
+ expect( await page.$( '.editor-post-publish-panel__toggle' ) ).toBeNull();
+ expect( await page.$( '.editor-post-publish-button' ) ).not.toBeNull();
+
+ await publishPostWithPrePublishChecksDisabled();
+
+ // The post-publishing panel should have been not shown.
+ expect( await page.$( '.editor-post-publish-panel' ) ).toBeNull();
+ } );
+ } );
+
+ describe.each( [ 'post', 'page' ] )( 'a %s in small viewports', ( postType ) => {
+ let werePrePublishChecksEnabled;
+
+ beforeEach( async () => {
+ await createNewPost( postType );
+ werePrePublishChecksEnabled = await arePrePublishChecksEnabled();
+ if ( werePrePublishChecksEnabled ) {
+ await disablePrePublishChecks();
+ }
+ await setBrowserViewport( 'small' );
+ } );
+
+ afterEach( async () => {
+ await setBrowserViewport( 'large' );
+ if ( werePrePublishChecksEnabled ) {
+ await enablePrePublishChecks();
+ }
+ } );
+
+ it( `should ignore the pre-publish checks and show the Publish... toggle instead of the Publish button`, async () => {
+ expect( await page.$( '.editor-post-publish-panel__toggle' ) ).not.toBeNull();
+ expect( await page.$( '.editor-post-publish-button' ) ).toBeNull();
+ } );
+ } );
} );
diff --git a/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js b/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
index cfcd565254f2e3..36eaa0cb12e004 100644
--- a/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
+++ b/packages/e2e-tests/specs/editor/various/reusable-blocks.test.js
@@ -155,9 +155,7 @@ describe( 'Reusable Blocks', () => {
// Convert block to a regular block
await clickBlockToolbarButton( 'More options' );
- const convertButton = await page.waitForXPath(
- '//button[text()="Convert to Regular Block"]'
- );
+ const convertButton = await page.waitForXPath( '//button[text()="Convert to Regular Block"]' );
await convertButton.click();
// Check that we have a paragraph block on the page
@@ -178,7 +176,9 @@ describe( 'Reusable Blocks', () => {
// Delete the block and accept the confirmation dialog
await clickBlockToolbarButton( 'More options' );
- const deleteButton = await page.waitForXPath( '//button[text()="Remove from Reusable Blocks"]' );
+ const deleteButton = await page.waitForXPath(
+ '//button[text()="Remove from Reusable Blocks"]'
+ );
await Promise.all( [ waitForAndAcceptDialog(), deleteButton.click() ] );
// Wait for deletion to finish
@@ -253,9 +253,7 @@ describe( 'Reusable Blocks', () => {
// Convert block to a regular block
await clickBlockToolbarButton( 'More options' );
- const convertButton = await page.waitForXPath(
- '//button[text()="Convert to Regular Block"]'
- );
+ const convertButton = await page.waitForXPath( '//button[text()="Convert to Regular Block"]' );
await convertButton.click();
// Check that we have two paragraph blocks on the page
diff --git a/packages/e2e-tests/specs/editor/various/rich-text.test.js b/packages/e2e-tests/specs/editor/various/rich-text.test.js
index 13acc998e39466..d4dcce7b1082cd 100644
--- a/packages/e2e-tests/specs/editor/various/rich-text.test.js
+++ b/packages/e2e-tests/specs/editor/various/rich-text.test.js
@@ -70,9 +70,9 @@ describe( 'RichText', () => {
await pressKeyWithModifier( 'shift', 'ArrowLeft' );
await pressKeyWithModifier( 'primary', 'b' );
- const count = await page.evaluate( () => document.querySelectorAll(
- '*[data-rich-text-format-boundary]'
- ).length );
+ const count = await page.evaluate(
+ () => document.querySelectorAll( '*[data-rich-text-format-boundary]' ).length
+ );
expect( count ).toBe( 1 );
} );
@@ -169,9 +169,7 @@ describe( 'RichText', () => {
records.forEach( ( record ) => {
if ( record.type !== 'characterData' ) {
- throw new Error(
- `Typing mutated more than character data: ${ record.type }`
- );
+ throw new Error( `Typing mutated more than character data: ${ record.type }` );
}
} );
@@ -182,21 +180,23 @@ describe( 'RichText', () => {
window.unsubscribes = [ () => mutationObserver.disconnect() ];
- document.addEventListener( 'selectionchange', () => {
- function throwMultipleSelectionChange() {
- throw new Error( 'Typing should only emit one selection change event.' );
- }
+ document.addEventListener(
+ 'selectionchange',
+ () => {
+ function throwMultipleSelectionChange() {
+ throw new Error( 'Typing should only emit one selection change event.' );
+ }
- document.addEventListener(
- 'selectionchange',
- throwMultipleSelectionChange,
- { once: true }
- );
+ document.addEventListener( 'selectionchange', throwMultipleSelectionChange, {
+ once: true,
+ } );
- window.unsubscribes.push( () => {
- document.removeEventListener( 'selectionchange', throwMultipleSelectionChange );
- } );
- }, { once: true } );
+ window.unsubscribes.push( () => {
+ document.removeEventListener( 'selectionchange', throwMultipleSelectionChange );
+ } );
+ },
+ { once: true }
+ );
} );
await page.keyboard.type( '4' );
diff --git a/packages/e2e-tests/specs/editor/various/rtl.test.js b/packages/e2e-tests/specs/editor/various/rtl.test.js
index 76e6d15ff9aa30..c4fd3797cc2926 100644
--- a/packages/e2e-tests/specs/editor/various/rtl.test.js
+++ b/packages/e2e-tests/specs/editor/various/rtl.test.js
@@ -18,7 +18,7 @@ describe( 'RTL', () => {
} );
it( 'should arrow navigate', async () => {
- await page.evaluate( () => document.dir = 'rtl' );
+ await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );
// We need at least three characters as arrow navigation *from* the
@@ -36,7 +36,7 @@ describe( 'RTL', () => {
} );
it( 'should split', async () => {
- await page.evaluate( () => document.dir = 'rtl' );
+ await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( ARABIC_ZERO );
@@ -48,7 +48,7 @@ describe( 'RTL', () => {
} );
it( 'should merge backward', async () => {
- await page.evaluate( () => document.dir = 'rtl' );
+ await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( ARABIC_ZERO );
@@ -61,7 +61,7 @@ describe( 'RTL', () => {
} );
it( 'should merge forward', async () => {
- await page.evaluate( () => document.dir = 'rtl' );
+ await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( ARABIC_ZERO );
@@ -75,7 +75,7 @@ describe( 'RTL', () => {
} );
it( 'should arrow navigate between blocks', async () => {
- await page.evaluate( () => document.dir = 'rtl' );
+ await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );
await page.keyboard.type( ARABIC_ZERO );
@@ -101,7 +101,7 @@ describe( 'RTL', () => {
} );
it( 'should navigate inline boundaries', async () => {
- await page.evaluate( () => document.dir = 'rtl' );
+ await page.evaluate( () => ( document.dir = 'rtl' ) );
await page.keyboard.press( 'Enter' );
await pressKeyWithModifier( 'primary', 'b' );
diff --git a/packages/e2e-tests/specs/editor/various/scheduling.test.js b/packages/e2e-tests/specs/editor/various/scheduling.test.js
index 3cd75b21d8e29b..01de009341e05c 100644
--- a/packages/e2e-tests/specs/editor/various/scheduling.test.js
+++ b/packages/e2e-tests/specs/editor/various/scheduling.test.js
@@ -1,9 +1,7 @@
/**
* WordPress dependencies
*/
-import {
- createNewPost,
-} from '@wordpress/e2e-test-utils';
+import { createNewPost } from '@wordpress/e2e-test-utils';
describe( 'Scheduling', () => {
beforeEach( createNewPost );
diff --git a/packages/e2e-tests/specs/editor/various/sidebar.test.js b/packages/e2e-tests/specs/editor/various/sidebar.test.js
index d0768f916f0f63..0f061c98add89d 100644
--- a/packages/e2e-tests/specs/editor/various/sidebar.test.js
+++ b/packages/e2e-tests/specs/editor/various/sidebar.test.js
@@ -24,15 +24,18 @@ describe( 'Sidebar', () => {
await setBrowserViewport( 'large' );
await clearLocalStorage();
await createNewPost();
- const { nodesCount, content, height, width } = await page.$$eval( ACTIVE_SIDEBAR_TAB_SELECTOR, ( nodes ) => {
- const firstNode = nodes[ 0 ];
- return {
- nodesCount: nodes.length,
- content: firstNode.innerText,
- height: firstNode.offsetHeight,
- width: firstNode.offsetWidth,
- };
- } );
+ const { nodesCount, content, height, width } = await page.$$eval(
+ ACTIVE_SIDEBAR_TAB_SELECTOR,
+ ( nodes ) => {
+ const firstNode = nodes[ 0 ];
+ return {
+ nodesCount: nodes.length,
+ content: firstNode.innerText,
+ height: firstNode.offsetHeight,
+ width: firstNode.offsetWidth,
+ };
+ }
+ );
// should have only one active sidebar tab.
expect( nodesCount ).toBe( 1 );
@@ -94,19 +97,21 @@ describe( 'Sidebar', () => {
// Tab lands at first (presumed selected) option "Document".
await page.keyboard.press( 'Tab' );
- const isActiveDocumentTab = await page.evaluate( () => (
- document.activeElement.textContent === 'Document' &&
- document.activeElement.classList.contains( 'is-active' )
- ) );
+ const isActiveDocumentTab = await page.evaluate(
+ () =>
+ document.activeElement.textContent === 'Document' &&
+ document.activeElement.classList.contains( 'is-active' )
+ );
expect( isActiveDocumentTab ).toBe( true );
// Tab into and activate "Block".
await page.keyboard.press( 'Tab' );
await page.keyboard.press( 'Space' );
- const isActiveBlockTab = await page.evaluate( () => (
- document.activeElement.textContent === 'Block' &&
- document.activeElement.classList.contains( 'is-active' )
- ) );
+ const isActiveBlockTab = await page.evaluate(
+ () =>
+ document.activeElement.textContent === 'Block' &&
+ document.activeElement.classList.contains( 'is-active' )
+ );
expect( isActiveBlockTab ).toBe( true );
} );
diff --git a/packages/e2e-tests/specs/editor/various/taxonomies.test.js b/packages/e2e-tests/specs/editor/various/taxonomies.test.js
index 4ed0ef3945fe61..311d4137e8785b 100644
--- a/packages/e2e-tests/specs/editor/various/taxonomies.test.js
+++ b/packages/e2e-tests/specs/editor/various/taxonomies.test.js
@@ -20,39 +20,38 @@ const TAG_TOKEN_SELECTOR = '.components-form-token-field__token-text span:not(.s
describe( 'Taxonomies', () => {
const canCreatTermInTaxonomy = ( taxonomy ) => {
- return page.evaluate(
- ( _taxonomy ) => {
- const post = wp.data.select( 'core/editor' ).getCurrentPost();
- if ( ! post._links ) {
- return false;
- }
- return !! post._links[ `wp:action-create-${ _taxonomy }` ];
- },
- taxonomy
- );
+ return page.evaluate( ( _taxonomy ) => {
+ const post = wp.data.select( 'core/editor' ).getCurrentPost();
+ if ( ! post._links ) {
+ return false;
+ }
+ return !! post._links[ `wp:action-create-${ _taxonomy }` ];
+ }, taxonomy );
};
const getSelectCategories = () => {
- return page.evaluate(
- () => {
- return Array.from( document.querySelectorAll(
+ return page.evaluate( () => {
+ return Array.from(
+ document.querySelectorAll(
'.editor-post-taxonomies__hierarchical-terms-choice .components-checkbox-control__input:checked'
- ) ).map( ( node ) => {
- return node.parentElement.nextSibling.innerText;
- } );
- }
- );
+ )
+ ).map( ( node ) => {
+ return node.parentElement.nextSibling.innerText;
+ } );
+ } );
};
const getCurrentTags = async () => {
const tagsPanel = await findSidebarPanelWithTitle( 'Tags' );
- return page.evaluate( ( node, selector ) => {
- return Array.from( node.querySelectorAll(
- selector
- ) ).map( ( field ) => {
- return field.innerText;
- } );
- }, tagsPanel, TAG_TOKEN_SELECTOR );
+ return page.evaluate(
+ ( node, selector ) => {
+ return Array.from( node.querySelectorAll( selector ) ).map( ( field ) => {
+ return field.innerText;
+ } );
+ },
+ tagsPanel,
+ TAG_TOKEN_SELECTOR
+ );
};
const openSidebarPanelWithTitle = async ( title ) => {
@@ -89,7 +88,9 @@ describe( 'Taxonomies', () => {
await page.click( '.editor-post-taxonomies__hierarchical-terms-submit' );
// Wait for the categories to load.
- await page.waitForSelector( '.editor-post-taxonomies__hierarchical-terms-choice .components-checkbox-control__input:checked' );
+ await page.waitForSelector(
+ '.editor-post-taxonomies__hierarchical-terms-choice .components-checkbox-control__input:checked'
+ );
let selectedCategories = await getSelectCategories();
@@ -107,7 +108,9 @@ describe( 'Taxonomies', () => {
await page.reload();
// Wait for the categories to load.
- await page.waitForSelector( '.editor-post-taxonomies__hierarchical-terms-choice .components-checkbox-control__input:checked' );
+ await page.waitForSelector(
+ '.editor-post-taxonomies__hierarchical-terms-choice .components-checkbox-control__input:checked'
+ );
selectedCategories = await getSelectCategories();
@@ -129,11 +132,7 @@ describe( 'Taxonomies', () => {
}
// At the start there are no tag tokens
- expect(
- await page.$$(
- TAG_TOKEN_SELECTOR
- )
- ).toHaveLength( 0 );
+ expect( await page.$$( TAG_TOKEN_SELECTOR ) ).toHaveLength( 0 );
const tagsPanel = await findSidebarPanelWithTitle( 'Tags' );
const tagInput = await tagsPanel.$( '.components-form-token-field__input' );
diff --git a/packages/e2e-tests/specs/editor/various/typewriter.test.js b/packages/e2e-tests/specs/editor/various/typewriter.test.js
index 98d54e17da1b7a..df5344f3a3fe37 100644
--- a/packages/e2e-tests/specs/editor/various/typewriter.test.js
+++ b/packages/e2e-tests/specs/editor/various/typewriter.test.js
@@ -8,14 +8,13 @@ describe( 'TypeWriter', () => {
await createNewPost();
} );
- const getCaretPosition = async () =>
- await page.evaluate( () => wp.dom.computeCaretRect().y );
+ const getCaretPosition = async () => await page.evaluate( () => wp.dom.computeCaretRect().y );
// Allow the scroll position to be 1px off.
const BUFFER = 1;
const getDiff = async ( caretPosition ) =>
- Math.abs( await getCaretPosition() - caretPosition );
+ Math.abs( ( await getCaretPosition() ) - caretPosition );
it( 'should maintain caret position', async () => {
// Create first block.
@@ -29,9 +28,11 @@ describe( 'TypeWriter', () => {
expect( await getCaretPosition() ).toBeGreaterThan( initialPosition );
// Create blocks until the the typewriter effect kicks in.
- while ( await page.evaluate( () =>
- wp.dom.getScrollContainer( document.activeElement ).scrollTop === 0
- ) ) {
+ while (
+ await page.evaluate(
+ () => wp.dom.getScrollContainer( document.activeElement ).scrollTop === 0
+ )
+ ) {
await page.keyboard.press( 'Enter' );
}
@@ -43,10 +44,13 @@ describe( 'TypeWriter', () => {
expect( await getDiff( newPosition ) ).toBeLessThanOrEqual( BUFFER );
// Type until the text wraps.
- while ( await page.evaluate( () =>
- document.activeElement.clientHeight <=
- parseInt( getComputedStyle( document.activeElement ).lineHeight, 10 )
- ) ) {
+ while (
+ await page.evaluate(
+ () =>
+ document.activeElement.clientHeight <=
+ parseInt( getComputedStyle( document.activeElement ).lineHeight, 10 )
+ )
+ ) {
await page.keyboard.type( 'a' );
}
@@ -76,14 +80,12 @@ describe( 'TypeWriter', () => {
await page.keyboard.press( 'Enter' );
// Create blocks until there is a scrollable container.
- while ( await page.evaluate( () =>
- ! wp.dom.getScrollContainer( document.activeElement )
- ) ) {
+ while ( await page.evaluate( () => ! wp.dom.getScrollContainer( document.activeElement ) ) ) {
await page.keyboard.press( 'Enter' );
}
- await page.evaluate( () =>
- wp.dom.getScrollContainer( document.activeElement ).scrollTop = 1
+ await page.evaluate(
+ () => ( wp.dom.getScrollContainer( document.activeElement ).scrollTop = 1 )
);
const initialPosition = await getCaretPosition();
@@ -115,18 +117,18 @@ describe( 'TypeWriter', () => {
await page.keyboard.press( 'Enter' );
// Create blocks until there is a scrollable container.
- while ( await page.evaluate( () =>
- ! wp.dom.getScrollContainer( document.activeElement )
- ) ) {
+ while ( await page.evaluate( () => ! wp.dom.getScrollContainer( document.activeElement ) ) ) {
await page.keyboard.press( 'Enter' );
}
let count = 0;
// Create blocks until the the typewriter effect kicks in.
- while ( await page.evaluate( () =>
- wp.dom.getScrollContainer( document.activeElement ).scrollTop === 0
- ) ) {
+ while (
+ await page.evaluate(
+ () => wp.dom.getScrollContainer( document.activeElement ).scrollTop === 0
+ )
+ ) {
await page.keyboard.press( 'Enter' );
count++;
}
diff --git a/packages/e2e-tests/specs/editor/various/writing-flow.test.js b/packages/e2e-tests/specs/editor/various/writing-flow.test.js
index f0683ff51e0f09..27ece9561c095b 100644
--- a/packages/e2e-tests/specs/editor/various/writing-flow.test.js
+++ b/packages/e2e-tests/specs/editor/various/writing-flow.test.js
@@ -68,14 +68,14 @@ describe( 'Writing Flow', () => {
// columns wrappers before escaping out.
let activeElementBlockType;
await page.keyboard.press( 'ArrowUp' );
- activeElementBlockType = await page.evaluate( () => (
+ activeElementBlockType = await page.evaluate( () =>
document.activeElement.getAttribute( 'data-type' )
- ) );
+ );
expect( activeElementBlockType ).toBe( 'core/column' );
await page.keyboard.press( 'ArrowUp' );
- activeElementBlockType = await page.evaluate( () => (
+ activeElementBlockType = await page.evaluate( () =>
document.activeElement.getAttribute( 'data-type' )
- ) );
+ );
expect( activeElementBlockType ).toBe( 'core/columns' );
// Arrow up from focused (columns) block wrapper exits nested context
@@ -238,23 +238,23 @@ describe( 'Writing Flow', () => {
// Should remain in title upon ArrowRight:
await page.keyboard.press( 'ArrowRight' );
- let isInTitle = await page.evaluate( () => (
- !! document.activeElement.closest( '.editor-post-title' )
- ) );
+ let isInTitle = await page.evaluate(
+ () => !! document.activeElement.closest( '.editor-post-title' )
+ );
expect( isInTitle ).toBe( true );
// Should remain in title upon modifier + ArrowDown:
await pressKeyWithModifier( 'primary', 'ArrowDown' );
- isInTitle = await page.evaluate( () => (
- !! document.activeElement.closest( '.editor-post-title' )
- ) );
+ isInTitle = await page.evaluate(
+ () => !! document.activeElement.closest( '.editor-post-title' )
+ );
expect( isInTitle ).toBe( true );
// Should navigate into blocks list upon ArrowDown:
await page.keyboard.press( 'ArrowDown' );
- const isInBlock = await page.evaluate( () => (
- !! document.activeElement.closest( '[data-type]' )
- ) );
+ const isInBlock = await page.evaluate(
+ () => !! document.activeElement.closest( '[data-type]' )
+ );
expect( isInBlock ).toBe( true );
} );
diff --git a/packages/e2e-tests/specs/experimental/block-transforms.test.js b/packages/e2e-tests/specs/experimental/block-transforms.test.js
index 16cc6890581dd6..f68403e9ded6b0 100644
--- a/packages/e2e-tests/specs/experimental/block-transforms.test.js
+++ b/packages/e2e-tests/specs/experimental/block-transforms.test.js
@@ -1,13 +1,7 @@
/**
* External dependencies
*/
-import {
- flatMap,
- map,
- mapValues,
- pickBy,
- some,
-} from 'lodash';
+import { flatMap, map, mapValues, pickBy, some } from 'lodash';
/**
* WordPress dependencies
@@ -36,18 +30,16 @@ import {
import { EXPECTED_TRANSFORMS } from '../../fixtures/block-transforms.js';
/*
-* Returns true if the fileBase refers to a fixture of a block
-* that should not be handled e.g: because of being deprecated,
-* or because of being a block that tests an error state.
-*/
+ * Returns true if the fileBase refers to a fixture of a block
+ * that should not be handled e.g: because of being deprecated,
+ * or because of being a block that tests an error state.
+ */
const isAnExpectedUnhandledBlock = ( fileBase ) => {
if ( fileBase.includes( 'deprecated' ) ) {
return true;
}
const { file: fixture } = getBlockFixtureParsedJSON( fileBase );
- const parsedBlockObject = JSON.parse(
- fixture
- )[ 0 ];
+ const parsedBlockObject = JSON.parse( fixture )[ 0 ];
return some(
[
null,
@@ -100,13 +92,14 @@ describe( 'Block transforms', () => {
const transformStructure = {};
beforeAll( async () => {
- await enableExperimentalFeatures( [ '#gutenberg-widget-experiments', '#gutenberg-menu-block' ] );
+ await enableExperimentalFeatures( [
+ '#gutenberg-widget-experiments',
+ '#gutenberg-menu-block',
+ ] );
await createNewPost();
for ( const fileBase of fileBasenames ) {
- const structure = await getTransformStructureFromFile(
- fileBase
- );
+ const structure = await getTransformStructureFromFile( fileBase );
if ( ! structure ) {
continue;
}
@@ -118,17 +111,12 @@ describe( 'Block transforms', () => {
it( 'should contain the expected transforms', async () => {
const transforms = mapValues(
- pickBy(
- transformStructure,
- ( { availableTransforms } ) => availableTransforms,
- ),
+ pickBy( transformStructure, ( { availableTransforms } ) => availableTransforms ),
( { availableTransforms, originalBlock } ) => {
return { originalBlock, availableTransforms };
}
);
- expect(
- transforms
- ).toEqual( EXPECTED_TRANSFORMS );
+ expect( transforms ).toEqual( EXPECTED_TRANSFORMS );
} );
describe( 'correctly transform', () => {
@@ -143,30 +131,29 @@ describe( 'Block transforms', () => {
const testTable = flatMap(
EXPECTED_TRANSFORMS,
- ( { originalBlock, availableTransforms }, fixture ) => (
- map(
- availableTransforms,
- ( destinationBlock ) => ( [
- originalBlock,
- fixture,
- destinationBlock,
- ] )
- )
- )
+ ( { originalBlock, availableTransforms }, fixture ) =>
+ map( availableTransforms, ( destinationBlock ) => [
+ originalBlock,
+ fixture,
+ destinationBlock,
+ ] )
);
// As Group is available as a transform on *all* blocks this would create a lot of
// tests which would impact on the performance of the e2e test suite.
// To avoid this, we remove `core/group` from test table for all but 2 block types.
- const testTableWithSomeGroupsFiltered = testTable.filter( ( transform ) => ( transform[ 2 ] !== 'Group' || transform[ 1 ] === 'core__paragraph__align-right' || transform[ 1 ] === 'core__image' ) );
+ const testTableWithSomeGroupsFiltered = testTable.filter(
+ ( transform ) =>
+ transform[ 2 ] !== 'Group' ||
+ transform[ 1 ] === 'core__paragraph__align-right' ||
+ transform[ 1 ] === 'core__image'
+ );
it.each( testTableWithSomeGroupsFiltered )(
'block %s in fixture %s into the %s block',
async ( originalBlock, fixture, destinationBlock ) => {
const { content } = transformStructure[ fixture ];
- expect(
- await getTransformResult( content, destinationBlock )
- ).toMatchSnapshot();
+ expect( await getTransformResult( content, destinationBlock ) ).toMatchSnapshot();
}
);
} );
diff --git a/packages/e2e-tests/specs/performance/performance.test.js b/packages/e2e-tests/specs/performance/performance.test.js
index 6246dfb4dc0d38..e6eac850260b40 100644
--- a/packages/e2e-tests/specs/performance/performance.test.js
+++ b/packages/e2e-tests/specs/performance/performance.test.js
@@ -49,7 +49,9 @@ describe( 'Performance', () => {
let startTime;
await page.on( 'load', () => results.load.push( new Date() - startTime ) );
- await page.on( 'domcontentloaded', () => results.domcontentloaded.push( new Date() - startTime ) );
+ await page.on( 'domcontentloaded', () =>
+ results.domcontentloaded.push( new Date() - startTime )
+ );
while ( i-- ) {
startTime = new Date();
diff --git a/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-group.js b/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-group.js
index a762c52a9f2a3a..44c47dc46a29bf 100644
--- a/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-group.js
+++ b/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-group.js
@@ -9,18 +9,22 @@ import { isEmpty, map } from 'lodash';
import { createSlotFill } from '@wordpress/components';
import { withSelect } from '@wordpress/data';
-const { Fill: PluginBlockSettingsMenuGroup, Slot } = createSlotFill( 'PluginBlockSettingsMenuGroup' );
+const { Fill: PluginBlockSettingsMenuGroup, Slot } = createSlotFill(
+ 'PluginBlockSettingsMenuGroup'
+);
const PluginBlockSettingsMenuGroupSlot = ( { fillProps, selectedBlocks } ) => {
selectedBlocks = map( selectedBlocks, ( block ) => block.name );
return (
-
- { ( fills ) => ! isEmpty( fills ) && (
- <>
-
- { fills }
- >
- ) }
+
+ { ( fills ) =>
+ ! isEmpty( fills ) && (
+ <>
+
+ { fills }
+ >
+ )
+ }
);
};
diff --git a/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js b/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js
index 8503692c289b07..6f3054a84b70b8 100644
--- a/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js
+++ b/packages/edit-post/src/components/block-settings-menu/plugin-block-settings-menu-item.js
@@ -14,7 +14,8 @@ import { compose } from '@wordpress/compose';
*/
import PluginBlockSettingsMenuGroup from './plugin-block-settings-menu-group';
-const isEverySelectedBlockAllowed = ( selected, allowed ) => difference( selected, allowed ).length === 0;
+const isEverySelectedBlockAllowed = ( selected, allowed ) =>
+ difference( selected, allowed ).length === 0;
/**
* Plugins may want to add an item to the menu either for every block
@@ -27,8 +28,8 @@ const isEverySelectedBlockAllowed = ( selected, allowed ) => difference( selecte
* @param {string[]} allowedBlocks Array containing the names of the blocks allowed
* @return {boolean} Whether the item will be rendered or not.
*/
-const shouldRenderItem = ( selectedBlocks, allowedBlocks ) => ! Array.isArray( allowedBlocks ) ||
- isEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );
+const shouldRenderItem = ( selectedBlocks, allowedBlocks ) =>
+ ! Array.isArray( allowedBlocks ) || isEverySelectedBlockAllowed( selectedBlocks, allowedBlocks );
/**
* Renders a new item in the block settings menu.
@@ -89,15 +90,20 @@ const PluginBlockSettingsMenuItem = ( { allowedBlocks, icon, label, onClick, sma
if ( ! shouldRenderItem( selectedBlocks, allowedBlocks ) ) {
return null;
}
- return ( );
+ return (
+
+ );
} }
);
diff --git a/packages/edit-post/src/components/browser-url/index.js b/packages/edit-post/src/components/browser-url/index.js
index ccaa0bcaa98f7a..34114fbefa44b7 100644
--- a/packages/edit-post/src/components/browser-url/index.js
+++ b/packages/edit-post/src/components/browser-url/index.js
@@ -75,11 +75,7 @@ export class BrowserURL extends Component {
* @param {number} postId Post ID for which to generate post editor URL.
*/
setBrowserURL( postId ) {
- window.history.replaceState(
- { id: postId },
- 'Post ' + postId,
- getPostEditURL( postId )
- );
+ window.history.replaceState( { id: postId }, 'Post ' + postId, getPostEditURL( postId ) );
this.setState( () => ( {
historyId: postId,
diff --git a/packages/edit-post/src/components/editor-initialization/listener-hooks.js b/packages/edit-post/src/components/editor-initialization/listener-hooks.js
index edefe8972fddcd..cdf6afa8b31661 100644
--- a/packages/edit-post/src/components/editor-initialization/listener-hooks.js
+++ b/packages/edit-post/src/components/editor-initialization/listener-hooks.js
@@ -20,14 +20,9 @@ import {
* @param {number} postId The current post id.
*/
export const useBlockSelectionListener = ( postId ) => {
- const {
- hasBlockSelection,
- isEditorSidebarOpened,
- } = useSelect(
+ const { hasBlockSelection, isEditorSidebarOpened } = useSelect(
( select ) => ( {
- hasBlockSelection: !! select(
- 'core/block-editor'
- ).getBlockSelectionStart(),
+ hasBlockSelection: !! select( 'core/block-editor' ).getBlockSelectionStart(),
isEditorSidebarOpened: select( STORE_KEY ).isEditorSidebarOpened(),
} ),
[ postId ]
@@ -101,7 +96,8 @@ export const useUpdatePostLinkListener = ( postId ) => {
const nodeToUpdate = useRef();
useEffect( () => {
- nodeToUpdate.current = document.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||
+ nodeToUpdate.current =
+ document.querySelector( VIEW_AS_PREVIEW_LINK_SELECTOR ) ||
document.querySelector( VIEW_AS_LINK_SELECTOR );
}, [ postId ] );
diff --git a/packages/edit-post/src/components/editor-initialization/test/listener-hooks.js b/packages/edit-post/src/components/editor-initialization/test/listener-hooks.js
index 0c8742bbe02fcc..3d55caa36e573e 100644
--- a/packages/edit-post/src/components/editor-initialization/test/listener-hooks.js
+++ b/packages/edit-post/src/components/editor-initialization/test/listener-hooks.js
@@ -38,12 +38,8 @@ describe( 'listener hook tests', () => {
};
let subscribeTrigger;
const registry = {
- select: jest.fn().mockImplementation(
- ( storeName ) => mockStores[ storeName ]
- ),
- dispatch: jest.fn().mockImplementation(
- ( storeName ) => mockStores[ storeName ]
- ),
+ select: jest.fn().mockImplementation( ( storeName ) => mockStores[ storeName ] ),
+ dispatch: jest.fn().mockImplementation( ( storeName ) => mockStores[ storeName ] ),
subscribe: ( subscription ) => {
subscribeTrigger = subscription;
},
@@ -51,21 +47,20 @@ describe( 'listener hook tests', () => {
const setMockReturnValue = ( store, functionName, value ) => {
mockStores[ store ][ functionName ] = jest.fn().mockReturnValue( value );
};
- const getSpyedFunction = (
- store,
- functionName
- ) => mockStores[ store ][ functionName ];
+ const getSpyedFunction = ( store, functionName ) => mockStores[ store ][ functionName ];
const renderComponent = ( testedHook, id, renderer = null ) => {
const TestComponent = ( { postId } ) => {
testedHook( postId );
return null;
};
- const TestedOutput =
-
- ;
- return renderer === null ?
- TestRenderer.create( TestedOutput ) :
- renderer.update( TestedOutput );
+ const TestedOutput = (
+
+
+
+ );
+ return renderer === null
+ ? TestRenderer.create( TestedOutput )
+ : renderer.update( TestedOutput );
};
afterEach( () => {
Object.values( mockStores ).forEach( ( storeMocks ) => {
@@ -81,12 +76,8 @@ describe( 'listener hook tests', () => {
act( () => {
renderComponent( useBlockSelectionListener, 10 );
} );
- expect(
- getSpyedFunction( STORE_KEY, 'isEditorSidebarOpened' )
- ).toHaveBeenCalled();
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).toHaveBeenCalledTimes( 0 );
+ expect( getSpyedFunction( STORE_KEY, 'isEditorSidebarOpened' ) ).toHaveBeenCalled();
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).toHaveBeenCalledTimes( 0 );
} );
it( 'opens block sidebar if block is selected', () => {
setMockReturnValue( STORE_KEY, 'isEditorSidebarOpened', true );
@@ -94,9 +85,9 @@ describe( 'listener hook tests', () => {
act( () => {
renderComponent( useBlockSelectionListener, 10 );
} );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).toHaveBeenCalledWith( 'edit-post/block' );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).toHaveBeenCalledWith(
+ 'edit-post/block'
+ );
} );
it( 'opens document sidebar if block is not selected', () => {
setMockReturnValue( STORE_KEY, 'isEditorSidebarOpened', true );
@@ -104,9 +95,9 @@ describe( 'listener hook tests', () => {
act( () => {
renderComponent( useBlockSelectionListener, 10 );
} );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).toHaveBeenCalledWith( 'edit-post/document' );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).toHaveBeenCalledWith(
+ 'edit-post/document'
+ );
} );
} );
describe( 'useAdjustSidebarListener', () => {
@@ -116,93 +107,83 @@ describe( 'listener hook tests', () => {
act( () => {
renderComponent( useAdjustSidebarListener, 10 );
} );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).not.toHaveBeenCalled();
- expect(
- getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' )
- ).not.toHaveBeenCalled();
- } );
- it( 'does not close sidebar if viewport is small and there is no ' +
- 'active sidebar name available', () => {
- setMockReturnValue( 'core/viewport', 'isViewPortMatch', true );
- setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', null );
- act( () => {
- renderComponent( useAdjustSidebarListener, 10 );
- } );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).not.toHaveBeenCalled();
- expect(
- getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' )
- ).not.toHaveBeenCalled();
- } );
- it( 'closes sidebar if viewport is small and there is an active ' +
- 'sidebar name available on initial render', () => {
- setMockReturnValue( 'core/viewport', 'isViewportMatch', true );
- setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'foo' );
- act( () => {
- renderComponent( useAdjustSidebarListener, 10 );
- } );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).not.toHaveBeenCalled();
- expect(
- getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' )
- ).toHaveBeenCalled();
- } );
- it( 'closes sidebar if viewport is small and there is an active ' +
- 'sidebar name available when viewport size changes', () => {
- setMockReturnValue( 'core/viewport', 'isViewportMatch', false );
- setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'foo' );
- // initial render does nothing and sidebar will be open already.
- act( () => {
- renderComponent( useAdjustSidebarListener, 10 );
- } );
- setMockReturnValue( 'core/viewport', 'isViewportMatch', true );
- // This render should result in the sidebar closing because viewport is
- // now small triggering a change.
- act( () => {
- subscribeTrigger();
- } );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).not.toHaveBeenCalled();
- expect(
- getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' )
- ).toHaveBeenCalledTimes( 1 );
- } );
- it( 'opens sidebar if viewport is not small, and there is a cached sidebar ' +
- 'to reopen on expand', () => {
- setMockReturnValue( 'core/viewport', 'isViewportMatch', false );
- setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'foo' );
- // initial render does nothing and sidebar should be open.
- act( () => {
- renderComponent( useAdjustSidebarListener, 10 );
- } );
- setMockReturnValue( 'core/viewport', 'isViewportMatch', true );
- setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'bar' );
- // next render should close the sidebar and active sidebar at time of
- // closing is cached.
- act( () => {
- subscribeTrigger();
- } );
- setMockReturnValue( 'core/viewport', 'isViewportMatch', false );
- setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', '' );
- // next render should open the sidebar to the cached general sidebar name.
- act( () => {
- subscribeTrigger();
- } );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).toHaveBeenCalledWith( 'bar' );
- expect(
- getSpyedFunction( STORE_KEY, 'openGeneralSidebar' )
- ).toHaveBeenCalledTimes( 1 );
- expect(
- getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' )
- ).toHaveBeenCalledTimes( 1 );
- } );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).not.toHaveBeenCalled();
+ expect( getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' ) ).not.toHaveBeenCalled();
+ } );
+ it(
+ 'does not close sidebar if viewport is small and there is no ' +
+ 'active sidebar name available',
+ () => {
+ setMockReturnValue( 'core/viewport', 'isViewPortMatch', true );
+ setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', null );
+ act( () => {
+ renderComponent( useAdjustSidebarListener, 10 );
+ } );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).not.toHaveBeenCalled();
+ expect( getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' ) ).not.toHaveBeenCalled();
+ }
+ );
+ it(
+ 'closes sidebar if viewport is small and there is an active ' +
+ 'sidebar name available on initial render',
+ () => {
+ setMockReturnValue( 'core/viewport', 'isViewportMatch', true );
+ setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'foo' );
+ act( () => {
+ renderComponent( useAdjustSidebarListener, 10 );
+ } );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).not.toHaveBeenCalled();
+ expect( getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' ) ).toHaveBeenCalled();
+ }
+ );
+ it(
+ 'closes sidebar if viewport is small and there is an active ' +
+ 'sidebar name available when viewport size changes',
+ () => {
+ setMockReturnValue( 'core/viewport', 'isViewportMatch', false );
+ setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'foo' );
+ // initial render does nothing and sidebar will be open already.
+ act( () => {
+ renderComponent( useAdjustSidebarListener, 10 );
+ } );
+ setMockReturnValue( 'core/viewport', 'isViewportMatch', true );
+ // This render should result in the sidebar closing because viewport is
+ // now small triggering a change.
+ act( () => {
+ subscribeTrigger();
+ } );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).not.toHaveBeenCalled();
+ expect( getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' ) ).toHaveBeenCalledTimes( 1 );
+ }
+ );
+ it(
+ 'opens sidebar if viewport is not small, and there is a cached sidebar ' +
+ 'to reopen on expand',
+ () => {
+ setMockReturnValue( 'core/viewport', 'isViewportMatch', false );
+ setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'foo' );
+ // initial render does nothing and sidebar should be open.
+ act( () => {
+ renderComponent( useAdjustSidebarListener, 10 );
+ } );
+ setMockReturnValue( 'core/viewport', 'isViewportMatch', true );
+ setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', 'bar' );
+ // next render should close the sidebar and active sidebar at time of
+ // closing is cached.
+ act( () => {
+ subscribeTrigger();
+ } );
+ setMockReturnValue( 'core/viewport', 'isViewportMatch', false );
+ setMockReturnValue( STORE_KEY, 'getActiveGeneralSidebarName', '' );
+ // next render should open the sidebar to the cached general sidebar name.
+ act( () => {
+ subscribeTrigger();
+ } );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).toHaveBeenCalledWith( 'bar' );
+ expect( getSpyedFunction( STORE_KEY, 'openGeneralSidebar' ) ).toHaveBeenCalledTimes( 1 );
+ expect( getSpyedFunction( STORE_KEY, 'closeGeneralSidebar' ) ).toHaveBeenCalledTimes( 1 );
+ }
+ );
} );
describe( 'useUpdatePostLinkListener', () => {
const setAttribute = jest.fn();
@@ -216,22 +197,14 @@ describe( 'listener hook tests', () => {
} );
it( 'updates nothing if there is no view link available', () => {
mockSelector.mockImplementation( () => null );
- setMockReturnValue(
- 'core/editor',
- 'getCurrentPost',
- { link: 'foo' }
- );
+ setMockReturnValue( 'core/editor', 'getCurrentPost', { link: 'foo' } );
act( () => {
renderComponent( useUpdatePostLinkListener, 10 );
} );
expect( setAttribute ).not.toHaveBeenCalled();
} );
it( 'updates nothing if there is no permalink', () => {
- setMockReturnValue(
- 'core/editor',
- 'getCurrentPost',
- { link: '' }
- );
+ setMockReturnValue( 'core/editor', 'getCurrentPost', { link: '' } );
act( () => {
renderComponent( useUpdatePostLinkListener, 10 );
} );
@@ -249,11 +222,7 @@ describe( 'listener hook tests', () => {
expect( mockSelector ).toHaveBeenCalledTimes( 1 );
} );
it( 'only updates the permalink when it changes', () => {
- setMockReturnValue(
- 'core/editor',
- 'getCurrentPost',
- { link: 'foo' }
- );
+ setMockReturnValue( 'core/editor', 'getCurrentPost', { link: 'foo' } );
act( () => {
renderComponent( useUpdatePostLinkListener, 10 );
} );
@@ -263,19 +232,11 @@ describe( 'listener hook tests', () => {
expect( setAttribute ).toHaveBeenCalledTimes( 1 );
} );
it( 'updates the permalink when it changes', () => {
- setMockReturnValue(
- 'core/editor',
- 'getCurrentPost',
- { link: 'foo' }
- );
+ setMockReturnValue( 'core/editor', 'getCurrentPost', { link: 'foo' } );
act( () => {
renderComponent( useUpdatePostLinkListener, 10 );
} );
- setMockReturnValue(
- 'core/editor',
- 'getCurrentPost',
- { link: 'bar' }
- );
+ setMockReturnValue( 'core/editor', 'getCurrentPost', { link: 'bar' } );
act( () => {
subscribeTrigger();
} );
diff --git a/packages/edit-post/src/components/header/feature-toggle/index.js b/packages/edit-post/src/components/header/feature-toggle/index.js
index 9dc6e3a5a93027..ed872a2a74afbc 100644
--- a/packages/edit-post/src/components/header/feature-toggle/index.js
+++ b/packages/edit-post/src/components/header/feature-toggle/index.js
@@ -11,7 +11,15 @@ import { compose } from '@wordpress/compose';
import { MenuItem, withSpokenMessages } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
-function FeatureToggle( { onToggle, isActive, label, info, messageActivated, messageDeactivated, speak } ) {
+function FeatureToggle( {
+ onToggle,
+ isActive,
+ label,
+ info,
+ messageActivated,
+ messageDeactivated,
+ speak,
+} ) {
const speakMessage = () => {
if ( isActive ) {
speak( messageDeactivated || __( 'Feature deactivated' ) );
@@ -24,7 +32,10 @@ function FeatureToggle( { onToggle, isActive, label, info, messageActivated, mes