import {test, expect} from '../../fixtures/test' // is used in grade tables and financial summaries for totals rows. // Screen readers use tfoot to distinguish summary data from body data. // canvas-rce must preserve tfoot alongside thead/tbody without merging them. test.describe('table tfoot element', () => { 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(' text is preserved in output', async ({page}) => { const content = await setAndGet( page, `
ItemPoints
Assignment 185
Total85
`, ) expect(content).toContain('Total') expect(content).toContain('Assignment 1') expect(content).toContain('85') }) test('full thead/tbody/tfoot structure preserves all sections', async ({page}) => { const content = await setAndGet( page, `
CategoryScoreMax
Midterm78100
Final91100
Average84.5100
`, ) expect(content).toContain('Category') expect(content).toContain('Midterm') expect(content).toContain('Final') expect(content).toContain('Average') expect(content).toContain('84.5') }) test(' with th cells is preserved', async ({page}) => { const content = await setAndGet( page, `
Data A100
Grand Total100
`, ) expect(content).toContain('Grand Total') expect(content).toContain('Data A') }) test(' with formatted content inside is preserved', async ({page}) => { const content = await setAndGet( page, `
Item$50
Total Due$50
`, ) expect(content).toContain('Total Due') expect(content).toMatch(//) }) test('tfoot row count matches source', async ({page}) => { const content = await setAndGet( page, `
Row 1
Row 2
Footer 1
Footer 2
`, ) expect(content).toContain('Footer 1') expect(content).toContain('Footer 2') expect(content).toContain('Row 1') expect(content).toContain('Row 2') }) })