was deprecated in HTML5 but still appears
// in legacy Canvas course content exported from older LMS systems or Word.
// Additionally, `scope`, `headers`, `axis`, and `abbr` on | / | carry
// accessibility semantics for complex data tables used in rubrics and schedules.
test.describe('table accessibility and legacy attributes', () => {
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('table with summary attribute — cell text preserved', async ({page}) => {
const content = await setAndGet(
page,
'',
)
expect(content).toContain('Monday')
expect(content).toContain('9:00 AM')
})
test('th with abbr attribute — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'| Student Name | Final Grade |
|---|
| Jane Doe | A | ',
)
expect(content).toContain('Student Name')
expect(content).toContain('Jane Doe')
})
test('td with headers attribute — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'',
)
expect(content).toContain('Alice')
expect(content).toContain('95')
})
test('th with scope="colgroup" — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'',
)
expect(content).toContain('Week')
expect(content).toContain('Grades')
expect(content).toContain('88')
})
test('table with axis attribute on cells — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'',
)
expect(content).toContain('Participation')
expect(content).toContain('10')
})
})
|