From fa5a02e53a2297cf6be36947bba36053b82d17dd Mon Sep 17 00:00:00 2001 From: Himanshu Pathak Date: Wed, 5 Feb 2025 14:42:53 +0530 Subject: [PATCH] E2E: Add regression test for spacer block in themes without spacing units (#68913) Co-authored-by: himanshupathak95 Co-authored-by: Mamaduka Co-authored-by: fullofcaffeine --- test/e2e/specs/editor/blocks/spacer.spec.js | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) 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(); + } ); } );