diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index c13852cac983f..c374c4ee2b0b5 100644 --- a/test/e2e/specs/editor/various/block-locking.spec.js +++ b/test/e2e/specs/editor/various/block-locking.spec.js @@ -81,4 +81,62 @@ test.describe( 'Block Locking', () => {

Some paragraph

` ); } ); + + test( 'block locking supersedes template locking', async ( { + editor, + page, + pageUtils, + } ) => { + await editor.insertBlock( { + name: 'core/group', + attributes: { + layout: { type: 'constrained' }, + templateLock: 'all', + }, + innerBlocks: [ + { + name: 'core/heading', + attributes: { content: 'Hello, hello' }, + }, + { + name: 'core/paragraph', + attributes: { content: 'WordPress' }, + }, + ], + } ); + + const paragraph = editor.canvas.getByRole( 'document', { + name: 'Paragraph block', + } ); + await paragraph.click(); + + await editor.clickBlockToolbarButton( 'Unlock' ); + await page.click( 'role=checkbox[name="Lock all"]' ); + await page.click( 'role=button[name="Apply"]' ); + + await expect( + page + .getByRole( 'toolbar', { name: 'Block tools' } ) + .getByRole( 'button', { name: 'Move up' } ) + ).toBeVisible(); + + await paragraph.click(); + await pageUtils.pressKeys( 'access+z' ); + + await expect.poll( editor.getBlocks ).toMatchObject( [ + { + name: 'core/group', + attributes: { + layout: { type: 'constrained' }, + templateLock: 'all', + }, + innerBlocks: [ + { + name: 'core/heading', + attributes: { content: 'Hello, hello' }, + }, + ], + }, + ] ); + } ); } );