Skip to content

Commit

Permalink
Test: Add e2e test for RichText line break preservation
Browse files Browse the repository at this point in the history
  • Loading branch information
Infinite-Null committed Jan 6, 2025
1 parent db9c7f0 commit 2f3f47c
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 @@ -34,6 +34,32 @@ test.describe( 'RichText (@firefox, @webkit)', () => {
expect( renderedText ).toBe( 'First Second Third' );
} );

test( 'should not strip line breaks when pasting with disableLineBreaks diabled', async ( {
editor,
pageUtils,
} ) => {
await editor.canvas
.locator( 'role=button[name="Add default block"i]' )
.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' );

expect( await editor.getBlocks() ).toMatchObject( [
{
name: 'core/paragraph',
attributes: { content: 'First<br>Second<br>Third' },
},
] );
} );

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

0 comments on commit 2f3f47c

Please sign in to comment.