import {test, expect} from '../../fixtures/test' // Named HTML entities (©, —, ™, …,  ) appear in // professionally authored course content. TinyMCE may preserve them as named // entities, convert to numeric form (©), or decode to literal Unicode. // All forms are acceptable — tests document actual round-trip behavior. test.describe('named HTML entities in 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('copyright symbol © is preserved in some form', async ({page}) => { const content = await setAndGet(page, '

Content © 2024 Instructure

') expect(content).toContain('2024 Instructure') // Accept literal ©, ©, or © expect(content).toMatch(/©|©|©/) }) test('trademark symbol ™ is preserved', async ({page}) => { const content = await setAndGet(page, '

Canvas™ Learning Management System

') expect(content).toContain('Learning Management System') expect(content).toMatch(/™|™|™/) }) test('registered trademark ® is preserved', async ({page}) => { const content = await setAndGet(page, '

Instructure®

') expect(content).toContain('Instructure') expect(content).toMatch(/®|®|®/) }) test('em dash — is preserved in some form', async ({page}) => { const content = await setAndGet( page, '

Canvas LMS—the leading LMS—serves millions.

', ) expect(content).toContain('Canvas LMS') expect(content).toContain('serves millions') // Em dash may be literal — or entity-encoded expect(content).toMatch(/—|—|—/) }) test('en dash – is preserved', async ({page}) => { const content = await setAndGet(page, '

Pages 10–25 are required reading.

') expect(content).toContain('Pages 10') expect(content).toContain('are required reading') expect(content).toMatch(/–|–|–/) }) test('ellipsis … is preserved', async ({page}) => { const content = await setAndGet(page, '

Loading…

') expect(content).toContain('Loading') expect(content).toMatch(/…|…|…/) }) test('non-breaking space   between words is handled', async ({page}) => { const content = await setAndGet(page, '

First Last

') expect(content).toContain('First') expect(content).toContain('Last') // nbsp may be preserved as entity or literal non-breaking space expect(content).toMatch(/First( | )Last/) }) test('left and right quotes “ ” are preserved', async ({page}) => { const content = await setAndGet( page, '

“To be or not to be” — Shakespeare

', ) expect(content).toContain('Shakespeare') // Curly quotes or straight quotes or entities — all acceptable expect(content).toMatch(/"|"|“|”|"/) }) test('fraction ½ is preserved', async ({page}) => { const content = await setAndGet(page, '

Eat ½ of the serving.

') expect(content).toContain('of the serving') expect(content).toMatch(/½|½|½/) }) test('multiple entities in one paragraph all survive', async ({page}) => { const content = await setAndGet(page, '

Cost: $5.99 — Sale ends…

') expect(content).toContain('Cost') expect(content).toContain('Sale ends') }) })