Skip to content

Commit

Permalink
Fix editor.getBlocks for unmodified default block (#48093)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin940726 committed Feb 15, 2023
1 parent 9d37dbc commit 63079c7
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions packages/e2e-test-utils-playwright/src/editor/get-blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@ export async function getBlocks( this: Editor ) {
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 ( blocks.length === 1 ) {
const blockName = blocks[ 0 ].name;
if (
blockName === window.wp.blocks.getDefaultBlockName() ||
blockName === window.wp.blocks.getFreeformContentHandlerName()
) {
return [];
}
if (
blocks.length === 1 &&
window.wp.blocks.isUnmodifiedDefaultBlock( blocks[ 0 ] )
) {
return [];
}

return blocks;
Expand Down

1 comment on commit 63079c7

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 63079c7.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4184391357
📝 Reported issues:

Please sign in to comment.