import {test, expect} from '../../fixtures/test' // , , and provide phonetic annotations for CJK characters. // They are essential for Japanese and Chinese language courses where students // need reading guides (furigana) above kanji. canvas-rce must preserve the // base text at minimum; loss of ruby markup would break language courses. test.describe(' phonetic annotation elements', () => { 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('kanji base text in is preserved', async ({page}) => { const content = await setAndGet(page, '

日本語にほんご

') // base text must survive even if ruby markup is stripped expect(content).toContain('日本語') }) test(' phonetic text is preserved or base text survives', async ({page}) => { const content = await setAndGet(page, '

漢字かんじの勉強

') expect(content).toContain('漢字') expect(content).toContain('勉強') }) test('
fallback parentheses — base text preserved', async ({page}) => { const content = await setAndGet( page, '

東京(とうきょう)

', ) expect(content).toContain('東京') }) test('multiple ruby elements in a sentence — all base text preserved', async ({page}) => { const content = await setAndGet( page, '

私わたしは学生がくせいです。

', ) expect(content).toContain('私') expect(content).toContain('学生') }) test('ruby annotation alongside Latin text', async ({page}) => { const content = await setAndGet( page, '

The word 水みず means water in Japanese.

', ) expect(content).toContain('water in Japanese') }) })