Skip to content

Commit

Permalink
Zoom out: Render in-between inserters when selected (#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 );

Check failure on line 35 in test/e2e/specs/site-editor/zoom-out.spec.js

View workflow job for this annotation

GitHub Actions / Playwright - 6

[chromium] › site-editor/zoom-out.spec.js:20:2 › Zoom Out › Clicking on inserter while on zoom-out should open the patterns tab on the inserter

1) [chromium] › site-editor/zoom-out.spec.js:20:2 › Zoom Out › Clicking on inserter while on zoom-out should open the patterns tab on the inserter Error: Timed out 5000ms waiting for expect(locator).toHaveCount(expected) Locator: getByLabel('Add pattern') Expected: 2 Received: 0 Call log: - expect.toHaveCount with timeout 5000ms - waiting for getByLabel('Add pattern') - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" - locator resolved to 0 elements - unexpected value "0" 33 | await expect( page.getByLabel( 'Add pattern' ) ).toHaveCount( 3 ); 34 | await page.getByLabel( 'Add pattern' ).first().click(); > 35 | await expect( page.getByLabel( 'Add pattern' ) ).toHaveCount( 2 ); | ^ 36 | 37 | await expect( 38 | page at /home/runner/work/gutenberg/gutenberg/test/e2e/specs/site-editor/zoom-out.spec.js:35:52
Expand Down

1 comment on commit cef484e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in cef484e.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9189174065
📝 Reported issues:

Please sign in to comment.