Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regression test for editor JS crash caused by rtlcss parsing exception #29326

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions packages/e2e-tests/specs/editor/various/rtl.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,29 @@ describe( 'RTL', () => {
} );
} );

// Regression test for https://github.com/WordPress/gutenberg/issues/29250.
it( 'should load the editor without errors when RTL is set at the WP admin level', async () => {
await page.evaluate( () => {
const scripts = Array.from( document.querySelectorAll( 'script' ) );
const snippetScriptEl = document.createElement( 'script' );
const newComponentsScriptEl = document.createElement( 'script' );
const head = document.head;

const componentsScriptSrc = scripts.find( ( s ) =>
s.src.match( /components\/index\.js/ )
).src;

snippetScriptEl.text = 'document.dir = "rtl";';
newComponentsScriptEl.src = componentsScriptSrc;

head.appendChild( snippetScriptEl );
head.appendChild( newComponentsScriptEl );
} );

// No assertions are needed as the test will fail if an error is thrown
// during the evaluate call above, or pass if no errors are thrown.
} );

it( 'should arrow navigate', async () => {
await page.keyboard.press( 'Enter' );

Expand Down