import {test, expect} from '../../fixtures/test'
//
counts down from the total to 1 — used in countdown lists,
// "top N" rankings in reverse order, and procedures that work backwards.
// The `reversed` boolean attribute and explicit `value` overrides on items
// must survive so the displayed numbering stays correct after save/reload.
test.describe(' and mixed value attributes', () => {
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(' items — all list items preserved', async ({page}) => {
const content = await setAndGet(
page,
'- Third place: Bronze
- Second place: Silver
- First place: Gold
',
)
expect(content).toContain('Third place: Bronze')
expect(content).toContain('First place: Gold')
})
test(' countdown — items preserved', async ({page}) => {
const content = await setAndGet(
page,
'- Item five
- Item four
- Item three
',
)
expect(content).toContain('Item five')
expect(content).toContain('Item three')
})
test(' with explicit li value overrides — items preserved', async ({page}) => {
const content = await setAndGet(
page,
'- Tenth step
- Eleventh step
- Twentieth step
',
)
expect(content).toContain('Tenth step')
expect(content).toContain('Eleventh step')
expect(content).toContain('Twentieth step')
})
test(' — items preserved', async ({page}) => {
const content = await setAndGet(
page,
'- Option C
- Option B
- Option A
',
)
expect(content).toContain('Option C')
expect(content).toContain('Option A')
})
})