import {test, expect} from '../../fixtures/test' // CSS display properties (flex, grid, inline-block, inline-flex) control // layout and appear in content pasted from design tools and templates. // TinyMCE may preserve or strip these values. Tests verify text is never // lost regardless of what the serializer does with layout CSS. test.describe('CSS display properties in inline styles', () => { 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('display: flex container — text preserved', async ({page}) => { const content = await setAndGet( page, '
Flex item AFlex item B
', ) expect(content).toContain('Flex item A') expect(content).toContain('Flex item B') }) test('display: grid container — text preserved', async ({page}) => { const content = await setAndGet( page, '

Grid cell 1

Grid cell 2

', ) expect(content).toContain('Grid cell 1') expect(content).toContain('Grid cell 2') }) test('display: inline-block on span — text preserved', async ({page}) => { const content = await setAndGet( page, '

Text with inline block here.

', ) expect(content).toContain('inline block') expect(content).toContain('here') }) test('display: none (hidden content) — text present in markup', async ({page}) => { const content = await setAndGet( page, '

Visible text.

Hidden text still in markup.

More visible text.

', ) expect(content).toContain('Visible text') expect(content).toContain('More visible text') // hidden content may or may not survive — document actual behavior expect(typeof content).toBe('string') }) test('display: table on div — text preserved', async ({page}) => { const content = await setAndGet( page, '
Cell content
', ) expect(content).toContain('Cell content') }) })