Files
clean-architecture-frontend…/tests/e2e/typography.spec.ts
T
DongHyeonka 8ed5beb8fd fix(design-system): 한국어 문구가 단어 사이에서만 줄바꿈되게 한다 (08-06)
문제: 스타일·토큰 어디에도 word-break가 없어 브라우저 기본값으로
한국어를 음절마다 끊는다. 골든에 "마운 / 트", "계 / 속할"이 있고, 텍스트
200%에서 로그인 버튼이 "로그 / 인"으로 쪼개졌다. PRODUCT.md의 한국어
기본 원칙과 맞지 않고 모든 파생 서비스가 받는다.

고른 방법: base.css에 :lang(ko) { word-break: keep-all; overflow-wrap:
break-word; }를 둔다. :lang(ko)라 en-US 문서 안의 lang="ko-KR" 구역에도
적용된다. 버린 대안: 리뷰 제안의 overflow-wrap: anywhere — min-content
계산에도 끊을 자리를 더해, 공간이 좁은 flex 항목(헤더 버튼)이 줄어들며
라벨을 다시 쪼갠다. break-word는 넘칠 때만 끊는다. 긴 영문·코드
토큰은 기존 pages.css의 anywhere 두 곳이 그대로 받는다.

위험·한계: 화면이 바뀐다. 좁은 칸에서 줄 수가 늘 수 있다. 시각 골든은
오케스트레이터가 갱신한다. 실제 브라우저 "글자만 확대" 설정에서의
줄바꿈은 눈으로 확인하지 않았다.

검증:
- RED: typography.spec.ts 새 테스트가 수정 전 chromium에서 실패
  (wordBreak "normal", overflowWrap "normal").
- GREEN: typography.spec.ts chromium·firefox·webkit 6/6 통과.
  accessibility·i18n(320px 가로 넘침 포함)·ui-gallery·app-shell·
  responsive·theme·compact-smoke·platform-overview chromium/compact
  34/34 통과. check-design-system PASS. 시각 회귀는 미실행.

Refs: docs/reviews/2026-11-01-maturity-review/08-presentation.md 08-06
2026-11-01 23:20:31 +09:00

49 lines
1.9 KiB
TypeScript

import { expect, test } from "../support/browser/strict-browser-test.ts";
// 08-04. Tailwind's preflight resets every heading to the body size and
// weight, so a section title read like a paragraph. Each level must stand
// apart from the next one and from body copy.
test("steps heading size and weight down from h2 to body copy", async ({
page,
}) => {
await page.goto("/examples/states");
await expect(page.getByRole("heading", { level: 1 })).toBeVisible();
const scale = await page.evaluate(() => {
const read = (element: Element | null) => {
if (!element) throw new Error("missing element");
const style = getComputedStyle(element);
return {
size: Number.parseFloat(style.fontSize),
weight: Number.parseFloat(style.fontWeight),
};
};
const main = document.querySelector("main");
return {
h2: read(main?.querySelector("h2") ?? null),
h3: read(main?.querySelector("h3") ?? null),
body: read(document.body),
};
});
expect(scale.h2.size).toBeGreaterThan(scale.h3.size);
expect(scale.h3.size).toBeGreaterThan(scale.body.size);
expect(scale.h2.weight).toBeGreaterThan(scale.body.weight);
expect(scale.h3.weight).toBeGreaterThan(scale.body.weight);
});
// 08-06. The browser default breaks Korean between any two syllables, so a
// button read "로그 / 인". Korean text breaks between words; a single word
// longer than its box still wraps instead of overflowing.
test("breaks Korean text between words, not inside them", async ({ page }) => {
await page.goto("/");
await expect(page.locator("html")).toHaveAttribute("lang", "ko-KR");
const wrapping = await page.locator("body").evaluate((body) => {
const style = getComputedStyle(body);
return { wordBreak: style.wordBreak, overflowWrap: style.overflowWrap };
});
expect(wrapping).toEqual({ wordBreak: "keep-all", overflowWrap: "break-word" });
});