Skip to content

Commit

Permalink
E2E: Test BlockSwitcher availability in l-post-ul-group CPT (WordPres…
Browse files Browse the repository at this point in the history
…s#60254)

Adds an E2E test for the fix in WordPress#60167 / 447c008.

In other words, when a post is locked at the root but contains an
unlocked group, any blocks in the latter should retain their
block-switching ability.
  • Loading branch information
mcsf authored and cbravobernal committed Apr 9, 2024
1 parent 277afc8 commit 6f5f444
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions test/e2e/specs/editor/plugins/post-type-locking.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,47 @@ test.describe( 'Post-type locking', () => {
},
] );
} );

test( 'should allow blocks to be switched to other types', async ( {
editor,
page,
} ) => {
await editor.canvas
.getByRole( 'document', {
name: 'Empty block',
} )
.first()
.fill( 'p1' );

const blockSwitcher = page
.getByRole( 'toolbar', { name: 'Block tools' } )
.getByRole( 'button', { name: 'Paragraph' } );

// Verify the block switcher exists.
await expect( blockSwitcher ).toHaveAttribute(
'aria-haspopup',
'true'
);

// Verify the correct block transforms appear.
await blockSwitcher.click();
await expect(
page
.getByRole( 'menu', { name: 'Paragraph' } )
.getByRole( 'menuitem' )
).toHaveText( [
'Heading',
'List',
'Quote',
'Buttons',
'Code',
'Columns',
'Group',
'Preformatted',
'Pullquote',
'Verse',
] );
} );
} );

test.describe( 'template_lock all locked group', () => {
Expand Down

0 comments on commit 6f5f444

Please sign in to comment.