import {test, expect} from '../../fixtures/test' // Footnotes use a pattern of with an anchor link in the body and a // matching
  • at the bottom. Canvas course pages use this for // citations, endnotes, and legal disclaimers. The link/id/sup chain must // survive round-trips for in-page navigation to work. test.describe('footnote pattern with superscript anchor links', () => { 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('footnote marker in body text is preserved', async ({page}) => { const content = await setAndGet( page, '

    Darwin proposed natural selection[1] in 1859.

    ', ) expect(content).toContain('Darwin proposed natural selection') expect(content).toContain('1859') expect(content).toContain('[1]') }) test('footnote list at bottom is preserved', async ({page}) => { const content = await setAndGet( page, '
    1. Darwin, C. (1859). On the Origin of Species. ↩

    ', ) expect(content).toContain('Darwin') expect(content).toContain('On the Origin of Species') }) test('body with footnote marker plus footnote list — all text preserved', async ({page}) => { const content = await setAndGet( page, '

    The study found significant results[1].


    1. Smith et al., 2023, p. 42.
    ', ) expect(content).toContain('significant results') expect(content).toContain('[1]') expect(content).toContain('Smith et al., 2023') }) test('multiple footnote markers in one paragraph', async ({page}) => { const content = await setAndGet( page, '

    Concept A[1] builds on concept B[2].

    ', ) expect(content).toContain('Concept A') expect(content).toContain('builds on concept B') expect(content).toContain('[1]') expect(content).toContain('[2]') }) })