Skip to content

Commit

Permalink
Temporarily apply #48093 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Feb 15, 2023
1 parent 6ea9ed3 commit a0f6010
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/e2e-test-utils-playwright/src/editor/get-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ import type { Editor } from './index';
*/
export async function getBlocks( this: Editor ) {
return await this.page.evaluate( () => {
const blocks = window.wp.data.select( 'core/block-editor' ).getBlocks();

// The editor might still contain an unmodified empty block even when it's technically "empty".
if ( window.wp.data.select( 'core/editor' ).isEditedPostEmpty() ) {
if (
blocks.length === 1 &&
window.wp.blocks.isUnmodifiedDefaultBlock( blocks[ 0 ] )
) {
return [];
}
return window.wp.data.select( 'core/block-editor' ).getBlocks();

return blocks;
} );
}

0 comments on commit a0f6010

Please sign in to comment.