import {test, expect} from '../../fixtures/test' // Inline color styling must survive round-trips so instructors can apply // color coding in course content (red for warnings, green for correct answers, // blue for definitions). Tests cover various color formats: hex, rgb, rgba, // named colors, and hsl values in both color and background-color. test.describe('color values in various CSS formats', () => { 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('rgb() color value — text preserved', async ({page}) => { const content = await setAndGet(page, '

Red RGB text

') expect(content).toContain('Red RGB text') }) test('rgba() color with transparency — text preserved', async ({page}) => { const content = await setAndGet( page, '

Semi-transparent navy

', ) expect(content).toContain('Semi-transparent navy') }) test('named color value — text preserved', async ({page}) => { const content = await setAndGet( page, '

Navy on yellow

', ) expect(content).toContain('Navy on yellow') }) test('hsl() color value — text preserved', async ({page}) => { const content = await setAndGet( page, '

HSL green text

', ) expect(content).toContain('HSL green text') }) test('hex shorthand color #abc — text preserved', async ({page}) => { const content = await setAndGet(page, '

Hex shorthand color

') expect(content).toContain('Hex shorthand color') }) test('multiple color properties on same element — text preserved', async ({page}) => { const content = await setAndGet( page, '

Warning box text

', ) expect(content).toContain('Warning box text') }) })