diff --git a/test/e2e/specs/editor/various/content-only-lock.spec.js b/test/e2e/specs/editor/various/content-only-lock.spec.js index e7d52562636f3b..9784aea1ee068f 100644 --- a/test/e2e/specs/editor/various/content-only-lock.spec.js +++ b/test/e2e/specs/editor/various/content-only-lock.spec.js @@ -76,4 +76,56 @@ test.describe( 'Content-only lock', () => { }, ] ); } ); + + test( 'should be able to automatically stop temporarily modify as blocks when an outside block is selected', async ( { + editor, + page, + pageUtils, + } ) => { + // Add content only locked block in the code editor + await pageUtils.pressKeys( 'secondary+M' ); // Emulates CTRL+Shift+Alt + M => toggle code editor + + await page.getByPlaceholder( 'Start writing with text or HTML' ) + .fill( ` +
+

Locked block a

+ + + +

Locked block b

+
+ + + +

outside block

+ ` ); + + await pageUtils.pressKeys( 'secondary+M' ); + // Select the content locked block. + await editor.canvas + .locator( 'role=document[name="Block: Group"i]' ) + .click(); + // Press modify to temporarily edit as blocks. + await editor.clickBlockOptionsMenuItem( 'Modify' ); + // Selected a nest paragraph verify Block is not content locked + // Styles can be changed and nested blocks can be removed + await editor.canvas + .locator( 'role=document[name="Block: Paragraph"i]' ) + .first() + .click(); + await expect( + page.locator( '.color-block-support-panel' ) + ).toBeAttached(); + await editor.clickBlockOptionsMenuItem( 'Delete' ); + // Select an outside block + await editor.canvas + .locator( 'role=document[name="Block: Heading"i]' ) + .click(); + // Select a locked nested paragraph block again + await pageUtils.pressKeys( 'ArrowUp' ); + // Block is content locked again simple styles like position can not be changed. + await expect( + page.locator( '.color-block-support-panel' ) + ).not.toBeAttached(); + } ); } );