import {test, expect} from '../../fixtures/test' // Definition lists (dl/dt/dd) are used in course content for glossaries, // FAQ sections, and term definitions. They are semantic HTML that screen // readers handle specially — canvas-rce must not flatten them to paragraphs. test.describe('definition lists (dl/dt/dd)', () => { 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('basic dl/dt/dd structure is preserved', async ({page}) => { const content = await setAndGet( page, '
HTML
HyperText Markup Language
', ) expect(content).toContain('HTML') expect(content).toContain('HyperText Markup Language') }) test('multiple term/definition pairs are all preserved', async ({page}) => { const content = await setAndGet( page, `
CSS
Cascading Style Sheets
JS
JavaScript
DOM
Document Object Model
`, ) expect(content).toContain('CSS') expect(content).toContain('Cascading Style Sheets') expect(content).toContain('JS') expect(content).toContain('JavaScript') expect(content).toContain('DOM') expect(content).toContain('Document Object Model') }) test('term with multiple definitions is preserved', async ({page}) => { const content = await setAndGet( page, '
Bark
Sound made by a dog
Outer layer of a tree
', ) expect(content).toContain('Bark') expect(content).toContain('Sound made by a dog') expect(content).toContain('Outer layer of a tree') }) test('dl inside a section paragraph context', async ({page}) => { const content = await setAndGet( page, '

Key terms for this module:

Algorithm
A step-by-step procedure

Review before the exam.

', ) expect(content).toContain('Key terms for this module') expect(content).toContain('Algorithm') expect(content).toContain('A step-by-step procedure') expect(content).toContain('Review before the exam') }) test('definition with formatted text in dd is preserved', async ({page}) => { const content = await setAndGet( page, '
Bold term
Definition with important word and emphasized concept.
', ) expect(content).toContain('Bold term') expect(content).toContain('important') expect(content).toContain('emphasized') }) test('dt with strong for emphasis is preserved', async ({page}) => { const content = await setAndGet( page, '
Critical Term
Must know for the exam.
', ) expect(content).toContain('Critical Term') expect(content).toContain('Must know for the exam') }) })