import {test, expect} from '../../fixtures/test' // Ordered lists in course content can have different numbering styles (roman // numerals, letters) and non-default start values. These are set via the // list-style-type CSS property or the type/start HTML attributes. // Legal citation, outlines, and multi-part assignments rely on this. test.describe('ordered list variants', () => { 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('ordered list with start attribute is preserved', async ({page}) => { const content = await setAndGet(page, '
  1. Item five
  2. Item six
') expect(content).toContain('Item five') expect(content).toContain('Item six') // start attribute enables mid-document continuation of numbering expect(content).toMatch(/start="5"/) }) test('ordered list with type="a" (lower-alpha) is handled', async ({page}) => { const content = await setAndGet( page, '
  1. First
  2. Second
  3. Third
', ) expect(content).toContain('First') expect(content).toContain('Second') expect(content).toContain('Third') // type attribute may be preserved or converted to list-style-type CSS expect(typeof content).toBe('string') }) test('ordered list with type="i" (lower-roman) content survives', async ({page}) => { const content = await setAndGet( page, '
  1. Introduction
  2. Methods
  3. Results
', ) expect(content).toContain('Introduction') expect(content).toContain('Methods') expect(content).toContain('Results') }) test('ordered list with list-style-type CSS preserves items', async ({page}) => { const content = await setAndGet( page, '
  1. Part One
  2. Part Two
', ) expect(content).toContain('Part One') expect(content).toContain('Part Two') }) test('nested ordered list with different types at each level', async ({page}) => { const content = await setAndGet( page, `
  1. Chapter One
    1. Section A
    2. Section B
  2. Chapter Two
`, ) expect(content).toContain('Chapter One') expect(content).toContain('Section A') expect(content).toContain('Section B') expect(content).toContain('Chapter Two') }) test('basic numbered list is preserved (default behavior)', async ({page}) => { const content = await setAndGet( page, '
  1. Step 1: Open the file
  2. Step 2: Edit the content
  3. Step 3: Save
', ) expect(content).toMatch(/
    { const content = await setAndGet( page, '
    1. Last place
    2. Second place
    3. First place
    ', ) expect(content).toContain('Last place') expect(content).toContain('First place') }) test('unordered list with disc/circle/square style-type preserves items', async ({page}) => { const content = await setAndGet( page, '', ) expect(content).toContain('Bullet A') expect(content).toContain('Bullet B') expect(content).toMatch(/