From 4395b60b391c598fe7ea67aeaaa9a35a34dabc4c Mon Sep 17 00:00:00 2001 From: ramon Date: Fri, 26 Jul 2024 11:02:26 +1000 Subject: [PATCH] Add e2e tests --- ...amed-enqueue-block-editor-settings.spec.js | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js b/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js index b4f502b2c9d0ba..bbdb5f3c5f2ba7 100644 --- a/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js +++ b/test/e2e/specs/editor/plugins/iframed-enqueue-block-editor-settings.spec.js @@ -96,4 +96,31 @@ test.describe( 'iframed block editor settings styles', () => { // Expect a 2px border because theme styles are enabled. await expect( defaultBlock ).toHaveCSS( 'border-width', '2px' ); } ); + + test( 'should set iframe html attributes based on locale through block editor settings', async ( { + editor, + page, + } ) => { + await page.evaluate( () => { + const settings = window.wp.data + .select( 'core/editor' ) + .getEditorSettings(); + window.wp.data.dispatch( 'core/editor' ).updateEditorSettings( { + ...settings, + locale: { + site: { + lang: 'ar', + isRTL: true, + }, + user: { + lang: 'en_US', + isRTL: false, + }, + }, + } ); + } ); + const htmlElement = editor.canvas.locator( 'css=html' ); + await expect( htmlElement ).toHaveAttribute( 'lang', 'ar' ); + await expect( htmlElement ).toHaveAttribute( 'dir', 'rtl' ); + } ); } );