Skip to content

Commit

Permalink
update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed May 11, 2023
1 parent 44108f7 commit a71e09d
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions test/e2e/specs/editor/various/block-switcher-test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,33 @@ test.describe( 'Block Switcher', () => {
},
],
} );
expect( await editor.getEditedPostContent() ).toBe(
`<!-- wp:group {"layout":{"type":"flex","orientation":"vertical"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>1</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->`
);
// Transform to `Stack` variation.
await editor.clickBlockToolbarButton( 'Stack' );
const variations = page.getByRole( 'menu', { name: 'Stack' } )
.getByRole( 'group', { name: 'variations' } );
const variations = page
.getByRole( 'menu', { name: 'Stack' } )
.getByRole( 'group' );
await expect(
variations.getByRole( 'menuitem', { name: 'Stack' } )
).toBeHidden();
await variations.getByRole( 'menuitem', { name: 'Row' } ).click();
expect( await editor.getEditedPostContent() ).toBe(
`<!-- wp:group {"layout":{"type":"flex","flexWrap":"nowrap"}} -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>1</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->`
);
expect( await editor.getBlocks() ).toMatchObject( [
{
name: 'core/group',
attributes: expect.objectContaining( {
layout: {
type: 'flex',
flexWrap: 'nowrap',
orientation: undefined,
},
} ),
innerBlocks: [
{
name: 'core/paragraph',
attributes: { content: '1' },
},
],
},
] );
await editor.clickBlockToolbarButton( 'Row' );
await expect(
page.locator( 'role=menuitem[name="Stack"i]' )
Expand Down

0 comments on commit a71e09d

Please sign in to comment.