import {test, expect} from '../../fixtures/test' // Legacy presentational elements (,
, ) exist in course content // authored years ago or imported from Word/HTML files. Canvas must not crash or // silently blank this content — even if TinyMCE converts the elements to CSS, // the text must survive so old courses remain readable after an RCE refactor. test.describe('legacy presentational elements from old content', () => { 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(' element text is preserved (may be converted to span+style)', async ({page}) => { const content = await setAndGet(page, '

Red large text

') expect(content).toContain('Red large text') }) test(' text is preserved', async ({page}) => { const content = await setAndGet(page, '

Arial text

') expect(content).toContain('Arial text') }) test('
element text is preserved (may become text-align:center)', async ({page}) => { const content = await setAndGet(page, '
Centered content
') expect(content).toContain('Centered content') }) test(' underline element is preserved or normalized', async ({page}) => { const content = await setAndGet(page, '

underlined text

') expect(content).toContain('underlined text') }) test(' element text is preserved', async ({page}) => { const content = await setAndGet(page, '

big text

') expect(content).toContain('big text') }) test(' element text is preserved', async ({page}) => { const content = await setAndGet(page, '

fine print

') expect(content).toContain('fine print') }) test(' nested in a table cell preserves text', async ({page}) => { const content = await setAndGet( page, '
Blue cell text
', ) expect(content).toContain('Blue cell text') }) test('mixed legacy and semantic elements in same paragraph', async ({page}) => { const content = await setAndGet( page, '

green and bold and underlined

', ) expect(content).toContain('green') expect(content).toContain('bold') expect(content).toContain('underlined') }) test(' inside a list item is preserved', async ({page}) => { const content = await setAndGet( page, '
  • Important item
  • Normal item
', ) expect(content).toContain('Important item') expect(content).toContain('Normal item') }) })