import {test, expect} from '../../fixtures/test' // MathML () is the XML-based markup language for mathematical notation. // Canvas uses MathJax which renders MathML and LaTeX; the raw MathML may // appear in content from equation editors or imported STEM course materials. // Tests verify that MathML text content and surrounding text survive. test.describe('MathML element content', () => { 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('paragraph text around is preserved', async ({page}) => { const content = await setAndGet( page, '

The formula is: x=2 and holds.

', ) expect(content).toContain('The formula is') expect(content).toContain('and holds') }) test(' with display block — surrounding paragraphs preserved', async ({page}) => { const content = await setAndGet( page, '

Euler\'s identity:

eiπ+1=0

This is remarkable.

', ) expect(content).toContain("Euler's identity") expect(content).toContain('This is remarkable') }) test('multiple inline elements — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '

When a and b are positive, a+b>0.

', ) expect(content).toContain('When') expect(content).toContain('are positive') }) test(' inside a table cell — surrounding text preserved', async ({page}) => { const content = await setAndGet( page, '
FormulaValue
x2Squared
', ) expect(content).toContain('Formula') expect(content).toContain('Squared') }) test(' does not crash editor', async ({page}) => { const content = await setAndGet( page, 'ab

End.

', ) expect(content).toContain('End') expect(typeof content).toBe('string') }) })