Skip to content

Commit

Permalink
Add test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Nov 28, 2024
1 parent 36c367e commit bab6c18
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/e2e/specs/site-editor/zoom-out.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ const EDITOR_ZOOM_OUT_CONTENT = `
<!-- /wp:group --></main>
<!-- /wp:group -->`;

const EDITOR_ZOOM_OUT_CONTENT_NO_SECTION_ROOT = `<!-- wp:group {"style":{"spacing":{"padding":{"top":"0","bottom":"0","left":"0","right":"0"}},"dimensions":{"minHeight":"100vh"}},"backgroundColor":"base-2","layout":{"type":"flex","orientation":"vertical","verticalAlignment":"space-between"}} -->
<div class="wp-block-group has-base-2-background-color has-background" style="min-height:100vh;padding-top:0;padding-right:0;padding-bottom:0;padding-left:0"><!-- wp:paragraph -->
<p>First Section Start</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph {"style":{"layout":{"selfStretch":"fit","flexSize":null}}} -->
<p>First Section Center</p>
<!-- /wp:paragraph -->
<!-- wp:paragraph -->
<p>First Section End</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->`;

test.describe( 'Zoom Out', () => {
test.beforeAll( async ( { requestUtils } ) => {
await requestUtils.activateTheme( 'twentytwentyfour' );
Expand Down Expand Up @@ -217,4 +231,16 @@ test.describe( 'Zoom Out', () => {
await expect( thirdSectionEnd ).toBeInViewport();
await expect( fourthSectionStart ).not.toBeInViewport();
} );

test( 'Zoom Out cannot be activated when the section root is missing', async ( {
page,
editor,
} ) => {
await editor.setContent( EDITOR_ZOOM_OUT_CONTENT_NO_SECTION_ROOT );

// Check that the zoom out button is not visible.
await expect(
page.getByRole( 'button', { name: 'Zoom Out' } )
).toBeHidden();
} );
} );

0 comments on commit bab6c18

Please sign in to comment.