Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Zoom Out if no section root to allow for Theme opt in #67232

Merged
merged 11 commits into from
Dec 2, 2024
Prev Previous commit
Next Next commit
Add test coverage
getdave committed Nov 29, 2024
commit 30f26498a97b1eb63bfce1fc49b00bc5a7ab73bf
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
@@ -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' );
@@ -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();
} );
} );