Files
clean-architecture-frontend…/tests/e2e/typography.spec.ts
T
DongHyeonka e7210c71bf test(e2e): 예제 화면 대신 플랫폼 라우트에서 셸 동작을 확인한다
셸 동작을 보는 e2e(반응형, 스크롤 복원, 해시 링크, 타이포그래피,
건너뛰기 링크, 메뉴 이동, 운영 CSP, compact, en-US의 lang)가 지울 예제
화면을 열거나 그 메뉴를 누른다.

홈과 /examples/platform으로 옮겼다. 스크롤 복원은 계약 표가 그려진 뒤
스크롤하고, 해시 링크는 비동기 표보다 위에 있는 첫 절을 대상으로
한다. WebKit은 scroll anchoring이 없어 표 아래 대상이 1px 밀렸다.
갤러리 자체의 320px 리플로는 앞 커밋의 workshop 시험이 맡는다.

위험: 홈과 플랫폼 개요의 모양이 바뀌면 이 시험들의 대상도 바뀐다.

검증(desktop): 샘플을 지운 최종 트리에서 test:e2e 183 passed.
2026-11-08 13:51:54 +09:00

50 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,
}) => {
// Section titles (h2) and card titles (h3) on the platform overview.
await page.goto("/examples/platform");
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" });
});