import {test, expect} from '../../fixtures/test' //
and appear in Canvas quiz content and course pages // that embed form-like UI. TinyMCE may strip form elements, but the // legend text (which labels the group) is meaningful content that should // not be silently lost. Tests document actual behavior. 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 survives round-trip', async ({page}) => { const content = await setAndGet( page, '
Personal Information

Enter your details below.

', ) expect(content).toContain('Personal Information') expect(content).toContain('Enter your details below') }) test('paragraph inside
is preserved', async ({page}) => { const content = await setAndGet( page, '
Settings

Configure your preferences.

Second paragraph.

', ) expect(content).toContain('Configure your preferences') expect(content).toContain('Second paragraph') }) test('text around
is preserved', async ({page}) => { const content = await setAndGet( page, '

Before fieldset.

Group

Group content.

After fieldset.

', ) expect(content).toContain('Before fieldset') expect(content).toContain('After fieldset') }) test('multiple nested
elements — all legends preserved', async ({page}) => { const content = await setAndGet( page, '
Outer group
Inner group

Nested content.

', ) expect(content).toContain('Outer group') expect(content).toContain('Inner group') expect(content).toContain('Nested content') }) test('
with formatted legend — text preserved', async ({page}) => { const content = await setAndGet( page, '
Required fields

Content here.

', ) expect(content).toContain('fields') expect(content).toContain('Content here') }) })