Skip to content

Commit

Permalink
E2E: Update test to use editor settings
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshupathak95 committed Feb 5, 2025
1 parent ef36763 commit fb08913
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions test/e2e/specs/editor/blocks/spacer.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,12 @@ test.describe( 'Spacer', () => {
} ) => {
// Mock the theme.json data to simulate a theme without spacing units
await page.evaluate( () => {
window.__originalSettings = window.__experimentalGetSettings();
window.__experimentalGetSettings = () => ( {
...window.__originalSettings,
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 },
} );
} );
Expand All @@ -68,12 +71,13 @@ test.describe( 'Spacer', () => {

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

await page.evaluate( () => {
if ( window.__originalSettings ) {
window.__experimentalGetSettings = () =>
window.__originalSettings;
window.wp.data
.dispatch( 'core/block-editor' )
.updateSettings( window.__originalSettings );
delete window.__originalSettings;
}
} );
Expand Down

0 comments on commit fb08913

Please sign in to comment.