import {test, expect} from '../../fixtures/test' // CSS containment (contain property) isolates subtrees for rendering performance. // isolation: isolate creates a new stacking context for z-index scoping. // overflow: clip differs from hidden by blocking all overflow including programmatic. // These properties appear in Canvas theme customizations and embedded widgets. test.describe('CSS containment, isolation, and overflow:clip', () => { 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('contain: layout on widget container — content preserved', async ({page}) => { const content = await setAndGet( page, '

Assignment Widget

Due in 3 days — complete the reading before class.

', ) expect(content).toContain('Assignment Widget') expect(content).toContain('complete the reading') }) test('contain: content on card — card text preserved', async ({page}) => { const content = await setAndGet( page, '

Module 4: Advanced Topics in Machine Learning

', ) expect(content).toContain('Advanced Topics in Machine Learning') }) test('contain: paint clips overflow — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

Before widget

Clipped content inside contained box.

After widget

', ) expect(content).toContain('Before widget') expect(content).toContain('Clipped content') expect(content).toContain('After widget') }) test('isolation: isolate on stacking context — text preserved', async ({page}) => { const content = await setAndGet( page, '

Isolated stacking context for modal overlay.

Overlay text
', ) expect(content).toContain('Isolated stacking context') expect(content).toContain('Overlay text') }) test('overflow: clip on image container — caption preserved', async ({page}) => { const content = await setAndGet( page, '
Lab microscope slide
Figure 1: Mitosis stage under 400x magnification
', ) expect(content).toContain('Lab microscope slide') expect(content).toContain('Mitosis stage') }) })