import {test, expect} from '../../fixtures/test'
// visibility: hidden hides elements without removing them from layout —
// used for tooltip triggers, conditional content, and print-only elements.
// CSS counters (counter-reset/counter-increment) generate automatic numbering
// for outlines and ordered structures without
. Text must survive both.
test.describe('CSS visibility and counter properties', () => {
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('visibility: hidden — surrounding text preserved', async ({page}) => {
const content = await setAndGet(
page,
'Visible text Hidden span more visible text.
',
)
expect(content).toContain('Visible text')
expect(content).toContain('more visible text')
})
test('visibility: visible (explicit) — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'Explicitly visible paragraph.
',
)
expect(content).toContain('Explicitly visible paragraph')
})
test('counter-reset on container — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'Counter reset container
First section item
',
)
expect(content).toContain('Counter reset container')
expect(content).toContain('First section item')
})
test('CSS counter on heading hierarchy — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'Introduction
Methodology
Results
',
)
expect(content).toContain('Introduction')
expect(content).toContain('Methodology')
expect(content).toContain('Results')
})
test('opacity: 0 (invisible but present) — text preserved', async ({page}) => {
const content = await setAndGet(
page,
'Normal text Transparent span text after.
',
)
expect(content).toContain('Normal text')
expect(content).toContain('after')
})
})