import {test, expect} from '../../fixtures/test' // Line height affects readability, especially for students with dyslexia or // visual impairments. Accessibility guidelines (WCAG 1.4.12) recommend // line-height of at least 1.5. Instructors set this via inline styles; // canvas-rce must preserve line-height values through serialization. test.describe('line-height CSS property', () => { 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('line-height unitless value on paragraph is handled', async ({page}) => { const content = await setAndGet( page, '

Spacious readable text for students.

', ) expect(content).toContain('Spacious readable text') }) test('line-height in pixels on paragraph is handled', async ({page}) => { const content = await setAndGet( page, '

Fixed pixel line height.

', ) expect(content).toContain('Fixed pixel line height') }) test('line-height in em units is handled', async ({page}) => { const content = await setAndGet( page, '

Double spaced paragraph.

', ) expect(content).toContain('Double spaced paragraph') }) test('line-height combined with font-size is handled', async ({page}) => { const content = await setAndGet( page, '

Readable body copy.

', ) expect(content).toContain('Readable body copy') }) test('line-height on a heading is handled', async ({page}) => { const content = await setAndGet(page, '

Tight heading

') expect(content).toContain('Tight heading') expect(content).toMatch(/

{ const content = await setAndGet( page, '

Normal double-spaced span normal.

', ) expect(content).toContain('double-spaced span') expect(content).toContain('Normal') expect(content).toContain('normal') }) test('multiple paragraphs each with different line-heights preserve all text', async ({page}) => { const content = await setAndGet( page, '

Tight paragraph.

Loose paragraph.

', ) expect(content).toContain('Tight paragraph') expect(content).toContain('Loose paragraph') }) })