import {test, expect} from '../../fixtures/test' // HTML comments () appear in course content from pasted Word docs, // LTI tool output, and legacy Canvas exports. TinyMCE has specific comment // handling — some are stripped, some preserved as inert text. Tests here // document the actual round-trip behavior so a refactor can verify it didn't change. test.describe('HTML comments in content', () => { 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 comments is preserved regardless of comment handling', async ({page}) => { const content = await setAndGet(page, '

BeforeAfter

') expect(content).toContain('Before') expect(content).toContain('After') }) test('comment between block elements does not corrupt surrounding content', async ({page}) => { const content = await setAndGet( page, '

First paragraph

Second paragraph

', ) expect(content).toContain('First paragraph') expect(content).toContain('Second paragraph') }) test('comment-wrapped script does not produce executable script tag', async ({page}) => { const content = await setAndGet( page, '

text

more

', ) // TinyMCE preserves the comment verbatim — alert() may appear inside it. // What must NOT happen: a bare