diff --git a/e2e/preview-text.test.ts b/e2e/preview-text.test.ts index c3e60f5..ada9313 100644 --- a/e2e/preview-text.test.ts +++ b/e2e/preview-text.test.ts @@ -1,3 +1,4 @@ +import { windowSizeForLine } from '../src/entities/Font/domain/windowSizeForLine/windowSizeForLine'; import { expect, test, @@ -5,12 +6,15 @@ import { test.describe('preview text', () => { test('drives the slider character rendering', async ({ comparison }) => { + const text = 'Sphinx'; await comparison.pickPair('Inter', 'Roboto'); - await comparison.setPreviewText('Sphinx'); + await comparison.setPreviewText(text); - // Window chars render as `.char-wrap` cells for crossfade. - // With WINDOW_SIZE=5, "Sphinx" (6 chars) fits 5 in the window. - await expect(comparison.slider.locator('.char-wrap')).toHaveCount(5); + // Window chars render as `.char-wrap` cells for crossfade. The window + // size is a pure function of the line's grapheme count — assert against + // the rule, not a hardcoded constant, so tuning the policy can't silently + // break this. "Sphinx" is one unwrapped line of 6 graphemes. + await expect(comparison.slider.locator('.char-wrap')).toHaveCount(windowSizeForLine(text.length)); }); test('preserves the typed value in the input', async ({ comparison }) => {