import {test, expect} from '../../fixtures/test' //
elements inside block-level elements (headings, blockquotes, list items, // table cells) appear in pasted content from Word and other sources. TinyMCE // may normalize them or preserve them — both are acceptable, but surrounding // text must never be lost in the process. test.describe('
line breaks inside block elements', () => { test.beforeEach(async ({page, rcePage}) => { await page.goto('/scenarios/basic') await rcePage.waitForEditor() }) async function setAndGet(page: any, html: string): Promise { return page.evaluate((content: string) => { // @ts-expect-error -- TinyMCE global window.tinymce.activeEditor.setContent(content) // @ts-expect-error -- TinyMCE global return window.tinymce.activeEditor.getContent() }, html) } test('
inside a heading preserves both lines of text', async ({page}) => { const content = await setAndGet(page, '

First Line
Second Line

') expect(content).toContain('First Line') expect(content).toContain('Second Line') expect(content).toMatch(/

inside a blockquote preserves all text', async ({page}) => { const content = await setAndGet( page, '

Line one.
Line two.
Line three.

', ) expect(content).toContain('Line one') expect(content).toContain('Line two') expect(content).toContain('Line three') }) test('
inside a list item preserves both parts', async ({page}) => { const content = await setAndGet( page, '', ) expect(content).toContain('First part') expect(content).toContain('Second part') expect(content).toContain('Normal item') }) test('
inside a table cell preserves both lines', async ({page}) => { const content = await setAndGet( page, '
Cell line 1
Cell line 2
Other cell
', ) expect(content).toContain('Cell line 1') expect(content).toContain('Cell line 2') expect(content).toContain('Other cell') }) test('multiple
in sequence inside a paragraph', async ({page}) => { const content = await setAndGet(page, '

Line A

Line B after blank line

') expect(content).toContain('Line A') expect(content).toContain('Line B after blank line') }) test('
between formatted elements in a heading', async ({page}) => { const content = await setAndGet( page, '

Bold first
Italic second

', ) expect(content).toContain('Bold first') expect(content).toContain('Italic second') expect(content).toMatch(/

inside a paragraph followed by another paragraph', async ({page}) => { const content = await setAndGet( page, '

Before break
After break

Separate paragraph

', ) expect(content).toContain('Before break') expect(content).toContain('After break') expect(content).toContain('Separate paragraph') }) })