diff --git a/test/e2e/specs/editor/blocks/spacer.spec.js b/test/e2e/specs/editor/blocks/spacer.spec.js index da262c9b4e26d9..620d1a3c967b88 100644 --- a/test/e2e/specs/editor/blocks/spacer.spec.js +++ b/test/e2e/specs/editor/blocks/spacer.spec.js @@ -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(); + } ); } );