import {test, expect} from '../../fixtures/test' //
and
are HTML5 semantic elements for self-contained // content with an optional caption (images, diagrams, code examples). // They improve accessibility by associating the caption with the content. // Canvas RCE must preserve their text through round-trips. 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, '
System diagram
Figure 1: System Architecture
', ) expect(content).toContain('Figure 1: System Architecture') }) test('
without figcaption text is preserved', async ({page}) => { const content = await setAndGet(page, '

Figure content without caption

') expect(content).toContain('Figure content without caption') }) test('
with formatted text is preserved', async ({page}) => { const content = await setAndGet( page, '
photo
Photo: Students in the lab
', ) expect(content).toContain('Students in the lab') expect(content).toMatch(//) }) test('multiple
elements all preserve captions', async ({page}) => { const content = await setAndGet( page, '
Caption one
Caption two
', ) expect(content).toContain('Caption one') expect(content).toContain('Caption two') }) test('
with a code block preserves caption and code', async ({page}) => { const content = await setAndGet( page, '
const x = 1;
Listing 1: Variable declaration
', ) expect(content).toContain('const x = 1') expect(content).toContain('Listing 1') }) test('
inside a list item preserves caption', async ({page}) => { const content = await setAndGet( page, '
  1. Step 1 diagram
', ) expect(content).toContain('Step 1 diagram') }) })