-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add: End to end test to make sure when all blocks get removed the def…
…ault block appender gets inserter and selected
- Loading branch information
1 parent
535e075
commit ca8f61f
Showing
4 changed files
with
40 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/** | ||
* Checks if the block that is focused is the default block. | ||
* | ||
* @return {Promise} Promise resolving with a boolean indicating if the focused block is the default block. | ||
*/ | ||
export function isInDefaultBlock() { | ||
return page.evaluate( () => { | ||
const activeBlockName = document.activeElement | ||
.closest( '[data-type]' ) | ||
.getAttribute( 'data-type' ); | ||
const defaultBlockName = window.wp.blocks.getDefaultBlockName(); | ||
|
||
return activeBlockName === defaultBlockName; | ||
} ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters