-
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.
Fix content locked patterns (#46494)
- Loading branch information
1 parent
98409e9
commit 570e7d9
Showing
3 changed files
with
38 additions
and
2 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
5 changes: 5 additions & 0 deletions
5
...y-lock-should-be-able-to-edit-the-content-of-blocks-with-content-only-lock-1-chromium.txt
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,5 @@ | ||
<!-- wp:group {"templateLock":"contentOnly","layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"><!-- wp:paragraph --> | ||
<p>Hello World</p> | ||
<!-- /wp:paragraph --></div> | ||
<!-- /wp:group --> |
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,31 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); | ||
|
||
test.describe( 'Content-only lock', () => { | ||
test.beforeEach( async ( { admin } ) => { | ||
await admin.createNewPost(); | ||
} ); | ||
|
||
test( 'should be able to edit the content of blocks with content-only lock', async ( { | ||
editor, | ||
page, | ||
pageUtils, | ||
} ) => { | ||
// Add content only locked block in the code editor | ||
await pageUtils.pressKeyWithModifier( 'secondary', 'M' ); // Emulates CTRL+Shift+Alt + M => toggle code editor | ||
await page.click( '.editor-post-text-editor' ); | ||
await page.keyboard | ||
.type( `<!-- wp:group {"templateLock":"contentOnly","layout":{"type":"constrained"}} --> | ||
<div class="wp-block-group"><!-- wp:paragraph --> | ||
<p>Hello</p> | ||
<!-- /wp:paragraph --></div> | ||
<!-- /wp:group -->` ); | ||
await pageUtils.pressKeyWithModifier( 'secondary', 'M' ); | ||
|
||
await page.click( 'role=document[name="Paragraph block"i]' ); | ||
await page.keyboard.type( ' World' ); | ||
expect( await editor.getEditedPostContent() ).toMatchSnapshot(); | ||
} ); | ||
} ); |