import {test, expect} from '../../fixtures/test' // Tables in course content must support header cells for accessibility. // Screen reader users rely on to understand column/row relationships. // canvas-rce must not strip or demote to during serialization. test.describe('table header 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(' elements are preserved in table header row', async ({page}) => { const content = await setAndGet( page, '
NameScore
Alice95
', ) expect(content).toMatch(/ and structure is preserved', async ({page}) => { const content = await setAndGet( page, '
Col A
data
', ) expect(content).toMatch(/ is preserved for a11y', async ({page}) => { const content = await setAndGet( page, '
Header
Cell
', ) expect(content).toMatch(/ { const content = await setAndGet( page, `
CategoryQ1Q2
Revenue100150
Expenses8090
`, ) expect(content).toContain('Category') expect(content).toContain('Revenue') expect(content).toContain('Expenses') // Should have multiple elements const thCount = (content.match(/ cell content can contain formatted text', async ({page}) => { const content = await setAndGet( page, '
Bold Headerdata
', ) expect(content).toMatch(/Bold Header<\/strong>/) }) })