Skip to content

Commit

Permalink
Add test case for when panel is toggled
Browse files Browse the repository at this point in the history
  • Loading branch information
delawski committed Aug 31, 2021
1 parent c78a754 commit 2ca8cc7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/e2e/specs/block-editor/amp-video-block.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ describe( 'Video Block Muted Notice', () => {
await expect( await autoplayContainer.evaluate( ( node ) => node.textContent ) ).toMatch( autoplayNotice );
await expect( await mutedContainer.evaluate( ( node ) => node.textContent ) ).toMatch( mutedNotice );

// Close and reopen the panel to confirm the notice is still there.
await clickButton( 'Video settings' );
await page.waitForXPath( '//button[@aria-expanded="false"][contains(text(), "Video settings")]' );
await clickButton( 'Video settings' );
await page.waitForXPath( '//button[@aria-expanded="true"][contains(text(), "Video settings")]' );

[ autoplayContainer, autoplayInput ] = await getBlockEditorSidebarToggle( 'Autoplay' );
[ mutedContainer, mutedInput ] = await getBlockEditorSidebarToggle( 'Muted' );

await expect( await autoplayInput.evaluate( ( node ) => node.checked ) ).toBe( true );
await expect( await mutedInput.evaluate( ( node ) => node.checked ) ).toBe( false );
await expect( await autoplayContainer.evaluate( ( node ) => node.textContent ) ).toMatch( autoplayNotice );
await expect( await mutedContainer.evaluate( ( node ) => node.textContent ) ).toMatch( mutedNotice );

// Insert new block so that the sidebar content changes.
await insertBlock( 'Code' );
await page.waitForSelector( '.wp-block-code' );
Expand Down

0 comments on commit 2ca8cc7

Please sign in to comment.