Skip to content

Commit

Permalink
Fix test for escape keypress in select mode
Browse files Browse the repository at this point in the history
  • Loading branch information
jeryj committed Jun 3, 2024
1 parent 48eb32f commit 8bd8957
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/e2e/specs/editor/various/writing-flow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,8 @@ test.describe( 'Writing Flow (@firefox, @webkit)', () => {
<!-- /wp:table -->` );
} );

test( 'escape should toggle between edit and navigation modes', async ( {
test( 'escape should set select mode and then focus the canvas', async ( {
editor,
page,
writingFlowUtils,
} ) => {
Expand All @@ -975,15 +976,11 @@ test.describe( 'Writing Flow (@firefox, @webkit)', () => {
.poll( writingFlowUtils.getActiveBlockName )
.toBe( 'core/paragraph' );

// Second escape Toggles back to Edit Mode
// Second escape should send focus to the canvas
await page.keyboard.press( 'Escape' );
// The navigation button should be hidden.
await expect( navigationButton ).toBeHidden();
const blockToolbar = page.getByLabel( 'Block tools' );

await expect( blockToolbar ).toBeVisible();
await expect
.poll( writingFlowUtils.getActiveBlockName )
.toBe( 'core/paragraph' );
await expect( editor.canvas.locator( 'body' ) ).toBeFocused();
} );

// Checks for regressions of https://github.com/WordPress/gutenberg/issues/40091.
Expand Down

0 comments on commit 8bd8957

Please sign in to comment.