import {test, expect} from '../../fixtures/test' // Tables with both rowspan and colspan in the same table are common in // complex data tables (grade sheets, comparison matrices). These are the // hardest table structures to serialize correctly — losing a span value // silently corrupts the visual layout without a test to detect it. test.describe('tables with combined rowspan and colspan', () => { 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('cell with rowspan=2 and sibling cells all preserve text', async ({page}) => { const content = await setAndGet( page, '
Spans 2 rowsRow 1 Col 2
Row 2 Col 2
', ) expect(content).toContain('Spans 2 rows') expect(content).toContain('Row 1 Col 2') expect(content).toContain('Row 2 Col 2') }) test('cell with colspan=2 alongside rowspan cell — all text preserved', async ({page}) => { const content = await setAndGet( page, '
CategoryValues
MinMax
Temperature1040
', ) expect(content).toContain('Category') expect(content).toContain('Values') expect(content).toContain('Min') expect(content).toContain('Max') expect(content).toContain('Temperature') }) test('header cell with colspan=3 — all column headers preserved', async ({page}) => { const content = await setAndGet( page, '
Full year results
Q1Q2Q3
102030
', ) expect(content).toContain('Full year results') expect(content).toContain('Q1') expect(content).toContain('Q2') expect(content).toContain('Q3') }) test('complex spanning matrix — all cell text preserved', async ({page}) => { const content = await setAndGet( page, '
Top-left 2x2Top right
Middle right
Bottom leftBottom midBottom right
', ) expect(content).toContain('Top-left 2x2') expect(content).toContain('Top right') expect(content).toContain('Bottom left') expect(content).toContain('Bottom right') }) })