import {test, expect} from '../../fixtures/test' // Custom elements (, ) appear in content copied // from design systems and web components. TinyMCE may strip unknown tags // but should preserve their text content. Tests document actual behavior // so a refactor doesn't accidentally change custom element handling. test.describe('custom HTML elements (Web Components)', () => { 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 inside a custom element survives round-trip', async ({page}) => { const content = await setAndGet( page, '

Before.

Custom callout text

After.

', ) expect(content).toContain('Before') expect(content).toContain('After') // text may survive inside the element or be extracted expect(typeof content).toBe('string') }) test('paragraph around custom element is preserved', async ({page}) => { const content = await setAndGet( page, '

Introduction.

Quiz content

Conclusion.

', ) expect(content).toContain('Introduction') expect(content).toContain('Conclusion') }) test('custom element with attributes — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Widget:

LTI content placeholder

End.

', ) expect(content).toContain('Widget') expect(content).toContain('End') }) test('nested custom elements — outer text preserved', async ({page}) => { const content = await setAndGet( page, '

Title inside custom

Body.

', ) expect(content).toContain('Title inside custom') expect(content).toContain('Body') }) })