import {test, expect} from '../../fixtures/test' // hreflang on identifies the language of the linked resource — essential // for multilingual Canvas sites where the same assignment exists in English // and Spanish, or where external resources are in a different language than // the course. Link text must survive regardless of the attribute's fate. test.describe('hreflang attribute on links', () => { 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('hreflang="es" on Spanish resource link — base text preserved', async ({page}) => { // Accented chars (ó) entity-encoded by TinyMCE; check non-accented portions const content = await setAndGet( page, '

Spanish version: Introduccion al curso

', ) expect(content).toContain('Introduccion al curso') }) test('hreflang="fr" on French external link — Latin text preserved', async ({page}) => { // TinyMCE entity-encodes accented characters; use ASCII-safe text const content = await setAndGet( page, '

French reading: Lire en francais

', ) expect(content).toContain('Lire en francais') }) test('multiple language links in one paragraph — all preserved', async ({page}) => { const content = await setAndGet( page, '

Available in: English, Spanish, French

', ) expect(content).toContain('English') expect(content).toContain('Spanish') expect(content).toContain('French') }) test('hreflang with type attribute — text preserved', async ({page}) => { const content = await setAndGet( page, '

Stundenplan (Deutsch)

', ) expect(content).toContain('Stundenplan') }) test('hreflang="zh-Hant" traditional Chinese — text preserved', async ({page}) => { const content = await setAndGet( page, '

Traditional Chinese: 繁體中文版

', ) // Chinese characters may be entity-encoded expect(content).toContain('Traditional Chinese') }) })