From 2f3f47c98e13e4b3472b6ce7a13098c313f100c9 Mon Sep 17 00:00:00 2001
From: Ankit Kumar Shah <ankit.shah@rtcamp.com>
Date: Mon, 6 Jan 2025 13:36:03 +0530
Subject: [PATCH] Test: Add e2e test for RichText line break preservation

---
 .../specs/editor/various/rich-text.spec.js    | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/test/e2e/specs/editor/various/rich-text.spec.js b/test/e2e/specs/editor/various/rich-text.spec.js
index 7e0357fa9ff7a8..d9f9f0b0d30420 100644
--- a/test/e2e/specs/editor/various/rich-text.spec.js
+++ b/test/e2e/specs/editor/various/rich-text.spec.js
@@ -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,