import {test, expect} from '../../fixtures/test' // is a semantic element for titles of creative works (books, films, // articles). It appears in course bibliographies and reading lists. // canvas-rce must preserve and its content through round-trips. test.describe(' element for work titles', () => { 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, '

See The Elements of Style for grammar guidance.

', ) expect(content).toContain('The Elements of Style') expect(content).toContain('grammar guidance') }) test(' inside a blockquote is preserved', async ({page}) => { const content = await setAndGet( page, '

To be or not to be.

Hamlet, Act 3
', ) expect(content).toContain('To be or not to be') expect(content).toContain('Hamlet') }) test('multiple elements in a bibliography all preserved', async ({page}) => { const content = await setAndGet( page, '
  1. Thinking, Fast and Slow by Kahneman
  2. Sapiens by Harari
', ) expect(content).toContain('Thinking, Fast and Slow') expect(content).toContain('Sapiens') expect(content).toContain('Kahneman') }) test(' with a link preserves both text and href structure', async ({page}) => { const content = await setAndGet( page, '

Refer to The Original Paper.

', ) expect(content).toContain('The Original Paper') }) test(' with italic formatting — text survives', async ({page}) => { const content = await setAndGet( page, '

The book On the Origin of Species changed biology.

', ) expect(content).toContain('On the Origin of Species') expect(content).toContain('changed biology') }) })