import {test, expect} from '../../fixtures/test' // Multiple
/ elements create accordion-style UI for FAQs, // glossaries, and expandable course sections. Canvas course designers use // this pattern to reduce cognitive load on long pages. All summary labels // and body content must survive round-trips. test.describe('accordion pattern with multiple
/ 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('three-section accordion — all summaries preserved', async ({page}) => { const content = await setAndGet( page, '
Question 1

Answer to question 1.

Question 2

Answer to question 2.

Question 3

Answer to question 3.

', ) expect(content).toContain('Question 1') expect(content).toContain('Question 2') expect(content).toContain('Question 3') expect(content).toContain('Answer to question 1') expect(content).toContain('Answer to question 3') }) test('details with open attribute — text preserved', async ({page}) => { const content = await setAndGet( page, '
Visible section

This section starts open.

', ) expect(content).toContain('Visible section') expect(content).toContain('This section starts open') }) test('nested details inside a details body — all text preserved', async ({page}) => { const content = await setAndGet( page, '
Outer topic

Outer content.

Sub-topic

Sub-content.

', ) expect(content).toContain('Outer topic') expect(content).toContain('Outer content') expect(content).toContain('Sub-topic') expect(content).toContain('Sub-content') }) test('accordion with mixed content types — all preserved', async ({page}) => { const content = await setAndGet( page, '
Term definition
Term
Definition here.
Code example
sample code
', ) expect(content).toContain('Term definition') expect(content).toContain('Definition here') expect(content).toContain('Code example') expect(content).toContain('sample code') }) test('details with heading as summary — text preserved', async ({page}) => { const content = await setAndGet( page, '

FAQ: How do I submit?

Submit via the Assignments page.

', ) expect(content).toContain('How do I submit') expect(content).toContain('Submit via the Assignments page') }) })