Skip to content

Commit

Permalink
E2E: Add regression test for spacer block in themes without spacing u…
Browse files Browse the repository at this point in the history
…nits (#68913)


Co-authored-by: himanshupathak95 <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: fullofcaffeine <[email protected]>
  • Loading branch information
4 people authored Feb 5, 2025
1 parent 3e4c376 commit fa5a02e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/e2e/specs/editor/blocks/spacer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,29 @@ test.describe( 'Spacer', () => {
)
).toBeFocused();
} );

test( 'should work in theme without spacing units support', async ( {
editor,
page,
} ) => {
await page.waitForFunction( () => window?.wp?.data );

// Mock the theme.json data to simulate a theme without spacing units
await page.evaluate( () => {
const settings = window.wp.data
.select( 'core/block-editor' )
.getSettings();
window.__originalSettings = settings;
window.wp.data.dispatch( 'core/block-editor' ).updateSettings( {
...settings,
spacing: { units: false },
} );
} );

await editor.insertBlock( { name: 'core/spacer' } );

await expect(
editor.canvas.locator( '.block-editor-warning' )
).toBeHidden();
} );
} );

1 comment on commit fa5a02e

@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 fa5a02e.
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/13153946010
📝 Reported issues:

Please sign in to comment.