import {test, expect} from '../../fixtures/test' // Microsoft Word generates verbose HTML with proprietary styles when content // is copy-pasted. Canvas instructors paste from Word constantly. TinyMCE's // paste plugin strips Word-specific markup but must preserve the meaningful // text and structure. Tests use typical Word HTML patterns. test.describe('Word-style HTML paste patterns', () => { 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('Word paragraph with mso-* styles — text preserved', async ({page}) => { const content = await setAndGet( page, '

Word document paragraph text

', ) expect(content).toContain('Word document paragraph text') }) test('Word heading with mso class — text preserved', async ({page}) => { const content = await setAndGet( page, '

Chapter One: Introduction

', ) expect(content).toContain('Chapter One: Introduction') expect(content).toMatch(/

{ const content = await setAndGet( page, '

First list item

Second list item

', ) expect(content).toContain('First list item') expect(content).toContain('Second list item') }) test('Word table with mso border styles — all cells preserved', async ({page}) => { const content = await setAndGet( page, '
Cell ACell B
', ) expect(content).toContain('Cell A') expect(content).toContain('Cell B') }) test('Word conditional comments — body text preserved', async ({page}) => { // TinyMCE preserves IE conditional comments () // as HTML comments, including content inside them. The body paragraph // must always be present; the conditional comment form is documented behavior. const content = await setAndGet( page, '

Main content text

', ) expect(content).toContain('Main content text') expect(typeof content).toBe('string') }) test('Word span with font styling — text preserved', async ({page}) => { const content = await setAndGet( page, '

Calibri text from Word

', ) expect(content).toContain('Calibri text from Word') }) })