import {test, expect} from '../../fixtures/test' // HTML5 form-related elements , , and belong in // forms and should not persist in RCE body content. Tests document whether // TinyMCE strips them and verify that surrounding text is always preserved. test.describe(', , and other HTML5 form 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('text around is preserved', async ({page}) => { const content = await setAndGet( page, '

Before datalist.

After datalist.

', ) expect(content).toContain('Before datalist') expect(content).toContain('After datalist') }) test(' element — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Result: 42 points earned.

', ) expect(content).toContain('Result') expect(content).toContain('points earned') }) test(' and together — all surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Progress: 70% | Score: 87

', ) expect(content).toContain('Progress') expect(content).toContain('Score') }) test(' is stripped — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Adjust: level

', ) expect(content).toContain('Adjust') expect(content).toContain('level') // input should be stripped expect(content).not.toContain(' is stripped — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Pick a color: for the theme.

', ) expect(content).toContain('Pick a color') expect(content).toContain('for the theme') expect(content).not.toContain('