From b98040afb17130cabf608087f9bd4b51d6ae0749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Sat, 24 Apr 2021 16:13:57 +0300 Subject: [PATCH] Fix e2e test --- .../editor/various/navigable-toolbar.test.js | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) 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 e108828c31e638..5a0c79151b2778 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.