import {test, expect} from '../../fixtures/test' // Legacy HTML table attributes (align, valign, width, bgcolor, cellpadding, // cellspacing) were the standard way to style tables before CSS. Canvas courses // authored before ~2010 or imported from Word contain these attributes. // Tests document whether TinyMCE preserves or converts them so refactors can // detect behavioral changes. test.describe('legacy table alignment and presentational 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 cell text is preserved regardless of align attribute', async ({page}) => { const content = await setAndGet( page, '
Centered cellRight cell
', ) expect(content).toContain('Centered cell') expect(content).toContain('Right cell') }) test('valign attribute on td — text preserved', async ({page}) => { const content = await setAndGet( page, '
Top alignedBottom aligned
', ) expect(content).toContain('Top aligned') expect(content).toContain('Bottom aligned') }) test('width attribute on td — text preserved', async ({page}) => { const content = await setAndGet( page, '
Fixed width cellPercentage cell
', ) expect(content).toContain('Fixed width cell') expect(content).toContain('Percentage cell') }) test('bgcolor on table row — text preserved', async ({page}) => { const content = await setAndGet( page, '
Colored row cell
', ) expect(content).toContain('Colored row cell') }) test('cellpadding and cellspacing on table — text preserved', async ({page}) => { const content = await setAndGet( page, '
Padded cell
', ) expect(content).toContain('Padded cell') }) test('table with border="1" — text preserved', async ({page}) => { const content = await setAndGet( page, '
Bordered table
', ) expect(content).toContain('Bordered table') }) test('th with scope attribute — text preserved', async ({page}) => { const content = await setAndGet( page, '
Column Header
Data
', ) expect(content).toContain('Column Header') expect(content).toContain('Data') }) test('table align="center" (deprecated) — text preserved', async ({page}) => { const content = await setAndGet( page, '
Centered table
', ) expect(content).toContain('Centered table') }) })