import {test, expect} from '../../fixtures/test' //
/ are HTML5 disclosure widgets used to create expandable // FAQ sections and spoilers in course content. TinyMCE may preserve or strip // them — this documents actual behavior so a refactor can detect regressions. test.describe('details and summary 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('
content text is preserved regardless of element handling', async ({page}) => { const content = await setAndGet( page, '
Click to expand

Hidden content revealed on click.

', ) // Even if element is stripped, text must survive expect(content).toContain('Click to expand') expect(content).toContain('Hidden content revealed on click') }) test(' text is preserved', async ({page}) => { const content = await setAndGet( page, '
FAQ: What is Canvas?

Canvas is an LMS.

', ) expect(content).toContain('FAQ: What is Canvas') expect(content).toContain('Canvas is an LMS') }) test('multiple details elements all preserve their content', async ({page}) => { const content = await setAndGet( page, `
Question 1

Answer 1

Question 2

Answer 2

Question 3

Answer 3

`, ) expect(content).toContain('Question 1') expect(content).toContain('Answer 1') expect(content).toContain('Question 2') expect(content).toContain('Answer 2') expect(content).toContain('Question 3') expect(content).toContain('Answer 3') }) test('
with open attribute content is preserved', async ({page}) => { const content = await setAndGet( page, '
Always visible

Pre-expanded content.

', ) expect(content).toContain('Always visible') expect(content).toContain('Pre-expanded content') }) test('formatted text inside details body is preserved', async ({page}) => { const content = await setAndGet( page, '
Hint

Use bold for emphasis and italic for terms.

', ) expect(content).toContain('Hint') expect(content).toContain('bold') expect(content).toContain('italic') }) })