From 82a5aebe5b214696088bd2f51558e7e608320760 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Wed, 15 Feb 2023 17:19:09 +0800 Subject: [PATCH] Fix getBlocks for unmodified default block --- .../src/editor/get-blocks.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts b/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts index dba597a19c9835..70a5a03628ee05 100644 --- a/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts +++ b/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts @@ -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;