Skip to content

Commit

Permalink
Writing flow: attempt to fix preview e2e failure (#33467)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and gwwar committed Jul 19, 2021
1 parent f8f616e commit d40b5a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,13 @@ export default function useTabNav() {
const direction = isShift ? 'findPrevious' : 'findNext';

if ( ! hasMultiSelection() && ! getSelectedBlockClientId() ) {
setNavigationMode( true );
// Preserve the behaviour of entering navigation mode when
// tabbing into the content without a block selection.
// `onFocusCapture` already did this previously, but we need to
// do it again here because after clearing block selection,
// focus land on the writing flow container and pressing Tab
// will no longer send focus through the focus capture element.
if ( event.target === node ) setNavigationMode( true );
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@wordpress/e2e-test-utils';

async function getComputedStyle( context, property ) {
await context.waitForSelector( '.wp-block-test-iframed-inline-styles' );
return await context.evaluate( ( prop ) => {
const container = document.querySelector(
'.wp-block-test-iframed-inline-styles'
Expand Down Expand Up @@ -47,9 +48,6 @@ describe( 'iframed inline styles', () => {
await page.keyboard.type( 'Iframed Test' );
await clickButton( 'Create' );
await page.waitForSelector( 'iframe[name="editor-canvas"]' );
await canvas().waitForSelector(
'.wp-block-test-iframed-inline-styles'
);

// Inline styles of properly enqueued stylesheet should load.
expect( await getComputedStyle( canvas(), 'padding' ) ).toBe( '20px' );
Expand Down

0 comments on commit d40b5a1

Please sign in to comment.