import {test, expect} from '../../fixtures/test' // with data/type attributes embeds PDFs, Flash (legacy), and other // media. Canvas uses for some media embeds and PDF previews. // TinyMCE preserves src/data intact (no client-side URL sanitization; // the backend/CSP handles that). Tests document actual behavior. test.describe(' element with data and type attributes', () => { 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 PDF embed is preserved', async ({page}) => { const content = await setAndGet( page, '

See the document:

PDF viewer not supported.

End of document.

', ) expect(content).toContain('See the document') expect(content).toContain('End of document') }) test(' fallback paragraph text is preserved', async ({page}) => { const content = await setAndGet( page, '

Flash not supported. Download instead.

', ) expect(content).toContain('Flash not supported') expect(content).toContain('Download instead') }) test(' with children — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Interactive:

Java not supported.

After object.

', ) expect(content).toContain('Interactive') expect(content).toContain('After object') }) test('multiple embeds — all surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Object 1

Object 2

End

', ) expect(content).toContain('Object 1') expect(content).toContain('Object 2') expect(content).toContain('End') }) })