-
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.
Inserter: use lighter grammar parse to check allowed status (#64902)
Co-authored-by: ellatrix <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: jsnajdr <[email protected]> Co-authored-by: tyxla <[email protected]>
- Loading branch information
Showing
7 changed files
with
98 additions
and
14 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,57 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Parsing patterns', () => { | ||
test( 'Considers a pattern with whitespace an allowed pattern', async ( { | ||
admin, | ||
editor, | ||
page, | ||
} ) => { | ||
await admin.createNewPost(); | ||
await editor.insertBlock( { | ||
name: 'core/buttons', | ||
innerBlocks: [ { name: 'core/button', attributes: { text: 'a' } } ], | ||
} ); | ||
await page.keyboard.press( 'ArrowDown' ); | ||
await page.getByLabel( 'Toggle block inserter' ).click(); | ||
|
||
await page.getByRole( 'tab', { name: 'Patterns' } ).click(); | ||
await page.evaluate( () => { | ||
window.wp.data.dispatch( 'core/block-editor' ).updateSettings( { | ||
__experimentalBlockPatterns: [ | ||
{ | ||
name: 'test/whitespace', | ||
title: 'Pattern with top-level whitespace', | ||
description: '', | ||
content: `<!-- wp:button --> | ||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">test</a></div> | ||
<!-- /wp:button --> | ||
<!-- wp:button --> | ||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">test</a></div> | ||
<!-- /wp:button -->`, | ||
}, | ||
], | ||
} ); | ||
} ); | ||
await page.fill( | ||
'role=region[name="Block Library"i] >> role=searchbox[name="Search for blocks and patterns"i]', | ||
'whitespace' | ||
); | ||
await page | ||
.locator( 'role=option[name="Pattern with top-level whitespace"i]' ) | ||
.click(); | ||
expect( await editor.getBlocks() ).toMatchObject( [ | ||
{ | ||
name: 'core/buttons', | ||
innerBlocks: [ | ||
{ name: 'core/button', attributes: { text: 'a' } }, | ||
{ name: 'core/button', attributes: { text: 'test' } }, | ||
{ name: 'core/button', attributes: { text: 'test' } }, | ||
], | ||
}, | ||
] ); | ||
} ); | ||
} ); |