diff --git a/packages/block-editor/src/components/block-tools/index.js b/packages/block-editor/src/components/block-tools/index.js index dba0adbbd8325f..ad744a81cca623 100644 --- a/packages/block-editor/src/components/block-tools/index.js +++ b/packages/block-editor/src/components/block-tools/index.js @@ -231,11 +231,12 @@ export default function BlockTools( { name="__unstable-block-tools-after" ref={ blockToolbarAfterRef } /> - { isZoomOutMode && ( - - ) } + { window.__experimentalEnableZoomedOutPatternsTab && + isZoomOutMode && ( + + ) } ); diff --git a/test/e2e/specs/site-editor/zoom-out.spec.js b/test/e2e/specs/site-editor/zoom-out.spec.js index 2cd0db8b1ebe22..3fed2b49f8e4a6 100644 --- a/test/e2e/specs/site-editor/zoom-out.spec.js +++ b/test/e2e/specs/site-editor/zoom-out.spec.js @@ -8,11 +8,31 @@ test.describe( 'Zoom Out', () => { await requestUtils.activateTheme( 'emptytheme' ); } ); - test.beforeEach( async ( { admin, editor } ) => { + test.beforeEach( async ( { admin, editor, page } ) => { + await admin.visitAdminPage( 'admin.php', 'page=gutenberg-experiments' ); + + const zoomedOutCheckbox = page.getByLabel( + 'Enable zoomed out view when selecting a pattern category in the main inserter.' + ); + + await zoomedOutCheckbox.setChecked( true ); + await expect( zoomedOutCheckbox ).toBeChecked(); + await page.getByRole( 'button', { name: 'Save Changes' } ).click(); + await admin.visitSiteEditor(); await editor.canvas.locator( 'body' ).click(); } ); + test.afterEach( async ( { admin, page } ) => { + await admin.visitAdminPage( 'admin.php', 'page=gutenberg-experiments' ); + const zoomedOutCheckbox = page.getByLabel( + 'Enable zoomed out view when selecting a pattern category in the main inserter.' + ); + await zoomedOutCheckbox.setChecked( false ); + await expect( zoomedOutCheckbox ).not.toBeChecked(); + await page.getByRole( 'button', { name: 'Save Changes' } ).click(); + } ); + test.afterAll( async ( { requestUtils } ) => { await requestUtils.activateTheme( 'twentytwentyone' ); } );