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 e108828c31e63..5a0c79151b277 100644 --- a/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js +++ b/packages/e2e-tests/specs/editor/various/navigable-toolbar.test.js @@ -3,6 +3,14 @@ */ import { createNewPost, pressKeyWithModifier } from '@wordpress/e2e-test-utils'; +async function isInBlockToolbar() { + return await page.evaluate( () => { + return !! document.activeElement.closest( + '.block-editor-block-toolbar' + ); + } ); +} + describe.each( [ [ 'unified', true ], [ 'contextual', false ], @@ -21,18 +29,6 @@ describe.each( [ }, 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 // block by ArrowDown.