From 8bad90cce6d276a62dda43eb146e3921f4f91ee5 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 15 Jun 2023 17:56:40 +0400 Subject: [PATCH] Add e2e tests for block locking and template lock --- .../editor/various/block-locking.spec.js | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/test/e2e/specs/editor/various/block-locking.spec.js b/test/e2e/specs/editor/various/block-locking.spec.js index c13852cac983fc..c374c4ee2b0b54 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' }, + }, + ], + }, + ] ); + } ); } );