import {test, expect} from '../../fixtures/test' // appears in legacy course content importing PDF documents, Flash // animations (now dead), and media players. TinyMCE must not crash on these // elements. Text around them must survive since TinyMCE is not the sanitizer // for embed src values. test.describe(' element handling', () => { 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(' PDF — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Course syllabus:

See above for details.

', ) expect(content).toContain('Course syllabus') expect(content).toContain('See above for details') }) test(' with type attribute — no crash, content is string', async ({page}) => { const content = await setAndGet( page, '

Media player:

', ) expect(typeof content).toBe('string') expect(content).toContain('Media player') }) test(' with width/height — text around preserved', async ({page}) => { const content = await setAndGet( page, '

Before embed

After embed

', ) expect(content).toContain('Before embed') expect(content).toContain('After embed') }) })