import {test, expect} from '../../fixtures/test' // tags belong in only. In a content body they are used to // inject external stylesheets (CSS injection attack) or load external // resources. canvas-rce must strip them to prevent style hijacking. test.describe(' tag in body — must be stripped', () => { 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(' is stripped', async ({page}) => { const content = await setAndGet( page, '

Safe text

', ) expect(content).not.toContain(' is stripped', async ({page}) => { const content = await setAndGet( page, '

Content

', ) expect(content).not.toContain(' is stripped', async ({page}) => { const content = await setAndGet( page, '

Page content

', ) expect(content).not.toContain(' tags is preserved', async ({page}) => { const content = await setAndGet( page, '

Title

Body

Footer

', ) expect(content).toContain('Title') expect(content).toContain('Body') expect(content).toContain('Footer') expect(content).not.toContain('