Skip to content

Commit

Permalink
Test: Add e2e test for RichText line break stripping in Site Title block
Browse files Browse the repository at this point in the history
  • Loading branch information
Infinite-Null committed Jan 6, 2025
1 parent 7dc2e7b commit db9c7f0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/e2e/specs/editor/various/rich-text.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,32 @@ test.describe( 'RichText (@firefox, @webkit)', () => {
await admin.createNewPost();
} );

test( 'should strip line breaks when pasting with disableLineBreaks enabled', async ( {
editor,
pageUtils,
} ) => {
await editor.insertBlock( { name: 'core/site-title' } );

await editor.canvas
.locator( 'role=textbox[name="Site title text"]' )
.click();

const multiLineContent = 'First<br/>Second<br/>Third';
pageUtils.setClipboardData( {
plainText: multiLineContent,
html: multiLineContent.replace( /\n/g, '<br>' ),
} );

await pageUtils.pressKeys( 'primary+a' );
await pageUtils.pressKeys( 'Backspace' );
await pageUtils.pressKeys( 'primary+v' );

const renderedText = await editor.canvas
.locator( 'role=textbox[name="Site title text"]' )
.innerText();
expect( renderedText ).toBe( 'First Second Third' );
} );

test( 'should handle change in tag name gracefully', async ( {
page,
editor,
Expand Down

0 comments on commit db9c7f0

Please sign in to comment.