import {test, expect} from '../../fixtures/test' // is an HTML5 semantic element for highlighted or marked text. // It's used in study guides, search results, and annotated course materials. // canvas-rce must preserve and its text through round-trips. test.describe(' highlight element', () => { 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, '

Remember to study the highlighted terms before the exam.

', ) expect(content).toContain('highlighted terms') expect(content).toContain('before the exam') }) test('multiple spans in a paragraph all preserved', async ({page}) => { const content = await setAndGet( page, '

First key point and second key point matter.

', ) expect(content).toContain('First key point') expect(content).toContain('second key point') }) test(' inside a list item is preserved', async ({page}) => { const content = await setAndGet( page, '
  • Definition: osmosis — movement of water
', ) expect(content).toContain('osmosis') expect(content).toContain('movement of water') }) test(' combined with preserves both', async ({page}) => { const content = await setAndGet( page, '

Critical concept must be understood.

', ) expect(content).toContain('Critical concept') expect(content).toMatch(//) }) test(' inside a blockquote is preserved', async ({page}) => { const content = await setAndGet( page, '

The most important idea is feedback loops.

', ) expect(content).toContain('feedback loops') expect(content).toContain('most important idea') }) test(' with a data attribute preserves text', async ({page}) => { const content = await setAndGet( page, '

photosynthesis produces glucose.

', ) expect(content).toContain('photosynthesis') expect(content).toContain('produces glucose') }) })