Skip to content

Commit fa5a02e

Browse files
himanshupathak95himanshupathak95Mamadukafullofcaffeine
authored
E2E: Add regression test for spacer block in themes without spacing units (#68913)
Co-authored-by: himanshupathak95 <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: fullofcaffeine <[email protected]>
1 parent 3e4c376 commit fa5a02e

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/e2e/specs/editor/blocks/spacer.spec.js

+25
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,29 @@ test.describe( 'Spacer', () => {
4848
)
4949
).toBeFocused();
5050
} );
51+
52+
test( 'should work in theme without spacing units support', async ( {
53+
editor,
54+
page,
55+
} ) => {
56+
await page.waitForFunction( () => window?.wp?.data );
57+
58+
// Mock the theme.json data to simulate a theme without spacing units
59+
await page.evaluate( () => {
60+
const settings = window.wp.data
61+
.select( 'core/block-editor' )
62+
.getSettings();
63+
window.__originalSettings = settings;
64+
window.wp.data.dispatch( 'core/block-editor' ).updateSettings( {
65+
...settings,
66+
spacing: { units: false },
67+
} );
68+
} );
69+
70+
await editor.insertBlock( { name: 'core/spacer' } );
71+
72+
await expect(
73+
editor.canvas.locator( '.block-editor-warning' )
74+
).toBeHidden();
75+
} );
5176
} );

0 commit comments

Comments
 (0)