import {test, expect} from '../../fixtures/test' // is a semantic element for abbreviations and acronyms; its title // attribute provides the full expansion to screen readers and on hover. // WCAG 3.1.4 requires the full expansion to be available. canvas-rce must // preserve and its title through round-trips. // is the deprecated HTML4 equivalent — it appears in legacy content. test.describe(' and elements', () => { 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', async ({page}) => { const content = await setAndGet( page, '

The WHO published a report.

', ) expect(content).toContain('WHO') expect(content).toContain('published a report') }) test(' attribute is preserved', async ({page}) => { const content = await setAndGet( page, '

HTML is foundational.

', ) expect(content).toContain('HTML') expect(content).toContain('title') expect(content).toContain('HyperText Markup Language') }) test('multiple elements in same paragraph all preserved', async ({page}) => { const content = await setAndGet( page, '

CSS and JS are web standards.

', ) expect(content).toContain('CSS') expect(content).toContain('JS') expect(content).toContain('web standards') }) test(' inside a list item is preserved', async ({page}) => { const content = await setAndGet( page, '
  • Use API keys
', ) expect(content).toContain('API') expect(content).toContain('keys') }) test(' legacy element text is preserved', async ({page}) => { const content = await setAndGet( page, '

The NASA mission succeeded.

', ) // text must survive; element may be converted to or preserved expect(content).toContain('NASA') expect(content).toContain('mission succeeded') }) test(' inside a table cell is preserved', async ({page}) => { const content = await setAndGet( page, '
Pts100
', ) expect(content).toContain('Pts') expect(content).toContain('100') }) })