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 (WordPress#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();
} );
} );

0 comments on commit fa5a02e

Please sign in to comment.