import {test, expect} from '../../fixtures/test' // CSS url() values in style attributes are a potential exfiltration vector. // TinyMCE preserves url() values as-is (it does NOT sanitize them client-side). // canvas-rce relies on backend CSP and server-side sanitization for this. // Tests document actual round-trip behavior so a refactor can detect changes. test.describe('CSS url() in style attributes — round-trip behavior', () => { 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('background url() in style is preserved by TinyMCE (not stripped client-side)', async ({ page, }) => { const content = await setAndGet( page, '
text
', ) // TinyMCE preserves url() — no JS executes from this expect(content).toContain('text') expect(content).not.toContain('alert') expect(typeof content).toBe('string') }) test('background-image url() round-trips without executing JS', async ({page}) => { const content = await setAndGet( page, '

para

', ) expect(content).toContain('para') expect(content).not.toContain('alert(') }) test('list-style-image url() preserves list content', async ({page}) => { const content = await setAndGet( page, '', ) expect(content).toContain('item') expect(content).toMatch(/