import {test, expect} from '../../fixtures/test' // is a native HTML modal element. Modern course content may include it // for interactive exercises, or it may arrive via copy-paste from modern web // pages. TinyMCE must not crash on it, and surrounding text must be preserved. test.describe(' HTML element', () => { 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(' with text content — no crash, content is string', async ({page}) => { const content = await setAndGet( page, '

Before dialog

Dialog content text.

After dialog

', ) expect(typeof content).toBe('string') // Surrounding paragraphs should survive expect(content).toContain('Before dialog') expect(content).toContain('After dialog') }) test(' without open — text preserved', async ({page}) => { const content = await setAndGet( page, '

Hidden dialog content.

Visible paragraph.

', ) expect(content).toContain('Visible paragraph') }) test(' with open attribute — dialog text preserved or content is string', async ({ page, }) => { const content = await setAndGet( page, '

Confirmation

Are you sure you want to submit?

', ) expect(typeof content).toBe('string') }) })