Skip to content

Commit

Permalink
Zoom out: Render in-between inserters when selected (WordPress#61559)
Browse files Browse the repository at this point in the history
  • Loading branch information
draganescu authored May 22, 2024
1 parent 25c9ddf commit cef484e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function ZoomOutModeInserters() {
sectionRootClientId,
insertionPoint,
setInserterIsOpened,
selectedSection,
} = useSelect( ( select ) => {
const { getSettings, getBlockOrder } = select( blockEditorStore );
const { sectionRootClientId: root } = unlock( getSettings() );
Expand All @@ -32,6 +33,7 @@ function ZoomOutModeInserters() {
// eslint-disable-next-line @wordpress/data-no-store-string-literals
const editor = select( 'core/editor' );
return {
selectedSection: editor.getSelectedBlock(),
blockOrder: getBlockOrder( root ),
insertionPoint: unlock( editor ).getInsertionPoint(),
sectionRootClientId: root,
Expand Down Expand Up @@ -62,7 +64,7 @@ function ZoomOutModeInserters() {
};
}, [] );

if ( ! isReady ) {
if ( ! isReady || ! selectedSection ) {
return null;
}

Expand Down
6 changes: 6 additions & 0 deletions test/e2e/specs/site-editor/zoom-out.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ test.describe( 'Zoom Out', () => {
await page.getByRole( 'button', { name: 'Styles' } ).click();
await page.getByRole( 'button', { name: 'Browse styles' } ).click();

// select the 1st pattern
await page
.frameLocator( 'iframe[name="editor-canvas"]' )
.locator( 'header' )
.click();

await expect( page.getByLabel( 'Add pattern' ) ).toHaveCount( 3 );
await page.getByLabel( 'Add pattern' ).first().click();
await expect( page.getByLabel( 'Add pattern' ) ).toHaveCount( 2 );
Expand Down

0 comments on commit cef484e

Please sign in to comment.