Skip to content

Commit

Permalink
Zoom Out: Hide inserters behind the experiment flag (WordPress#61866)
Browse files Browse the repository at this point in the history
* Zoom Out: Hide inserters behind the experiment flag

* Enable the test before we run the E2E test

Co-authored-by: scruffian <scruffian@git.wordpress.org>
Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
  • Loading branch information
3 people authored and patil-vipul committed Jun 17, 2024
1 parent 68b2ea0 commit 9a709bb
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
11 changes: 6 additions & 5 deletions packages/block-editor/src/components/block-tools/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,12 @@ export default function BlockTools( {
name="__unstable-block-tools-after"
ref={ blockToolbarAfterRef }
/>
{ isZoomOutMode && (
<ZoomOutModeInserters
__unstableContentRef={ __unstableContentRef }
/>
) }
{ window.__experimentalEnableZoomedOutPatternsTab &&
isZoomOutMode && (
<ZoomOutModeInserters
__unstableContentRef={ __unstableContentRef }
/>
) }
</InsertionPointOpenRef.Provider>
</div>
);
Expand Down
22 changes: 21 additions & 1 deletion test/e2e/specs/site-editor/zoom-out.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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' );
} );
Expand Down

0 comments on commit 9a709bb

Please sign in to comment.