import {test, expect} from '../../fixtures/test' // word-break, overflow-wrap (formerly word-wrap), and hyphens control how // long words wrap within containers. Used for code blocks with long identifiers, // URL display, and narrow table cells with long content. Text must survive // regardless of TinyMCE's handling of these wrapping CSS properties. test.describe('CSS word-break, overflow-wrap, and hyphens', () => { 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-break: break-all — text preserved', async ({page}) => { const content = await setAndGet( page, '

superlongwordthatwillbreakanywhereinthemiddleofanycharacter

', ) expect(content).toContain('superlongword') }) test('word-break: keep-all — text preserved', async ({page}) => { const content = await setAndGet( page, '

Keep all words together without breaking

', ) expect(content).toContain('Keep all words together') }) test('overflow-wrap: break-word — text preserved', async ({page}) => { const content = await setAndGet( page, '

https://very-long-url-example.instructure.com/courses/12345/assignments/67890

', ) expect(content).toContain('courses') }) test('overflow-wrap: anywhere — text preserved', async ({page}) => { const content = await setAndGet( page, 'VeryLongTableCellContentWithoutSpaces', ) expect(content).toContain('VeryLongTableCell') }) test('hyphens: auto — text preserved', async ({page}) => { const content = await setAndGet( page, '

This paragraph will use automatic hyphenation for long words in justified text.

', ) expect(content).toContain('automatic hyphenation') }) test('hyphens: none — text preserved', async ({page}) => { const content = await setAndGet( page, '

No hyphenation applied to this paragraph.

', ) expect(content).toContain('No hyphenation applied') }) test('white-space: break-spaces — text preserved', async ({page}) => { const content = await setAndGet( page, '

Break spaces text content here.

', ) expect(content).toContain('Break spaces text content') }) })