문제: LocaleProvider가 <html lang>을 선택한 locale로 바꾸는데, 예제 화면 4개는 의도적으로 catalog 밖이라 본문이 한국어 literal이다. en-US로 바꾸면 /examples/platform main의 한글 1,013자가 lang="en-US" 아래에 있어 스크린 리더가 영어 규칙으로 읽는다(WCAG 3.1.2). 고른 방법: 리뷰 대안 (B). 예제 화면 루트 section에 lang="ko-KR"을 준다. 예제를 catalog 밖에 둔 결정(VD-06, check-i18n 예외)은 그대로다. 버린 대안: (C) 예제 문구 번역 — 문구 수백 개이고 지울 수 있는 예제다. 예제 안에 중첩 LocaleProvider(ko-KR) — <html lang>을 전역으로 바꾼다. 위험·한계: 예제 안에서 디자인 시스템 컴포넌트가 catalog로 그리는 문구(접근 상태 화면, 오류 문구, 닫기 같은 접근성 이름)는 en-US에서 영어인데 ko-KR 구역 안에 놓인다. 화면 상태 갤러리에 몇 줄 있다. 한국어 본문 전체가 영어 규칙으로 읽히던 것보다 범위가 훨씬 작아 받아들였다. 예제를 번역하기로 하면 (C)로 간다. 눈에 보이는 화면 변화는 없다. 검증: - RED: i18n.spec.ts 새 테스트가 수정 전 chromium에서 실패 (Platform composition: lang Expected "ko-KR", Received ""). - GREEN: i18n·accessibility·ui-gallery·platform-overview e2e chromium·firefox·webkit 69/69 통과. tests/component 220/220, check-i18n PASS, tsc app 통과, eslint 통과. Refs: docs/reviews/2026-11-01-maturity-review/08-presentation.md 08-07
101 lines
4.0 KiB
TypeScript
101 lines
4.0 KiB
TypeScript
import { expect, test } from "../support/browser/strict-browser-test.ts";
|
|
|
|
test("switches the shell locale and keeps pseudo-locale copy within compact layout", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 320, height: 720 });
|
|
await page.goto("/");
|
|
|
|
const locale = page.getByRole("combobox", { name: "언어" });
|
|
await locale.selectOption("en-US");
|
|
await expect(page.locator("html")).toHaveAttribute("lang", "en-US");
|
|
await expect(page.locator("html")).toHaveAttribute("dir", "ltr");
|
|
await expect(page.getByRole("button", { name: "Menu" })).toBeVisible();
|
|
|
|
await page.getByRole("combobox", { name: "Language" }).selectOption("en-XA");
|
|
await expect(page.locator("html")).toHaveAttribute("lang", "en-XA");
|
|
const dimensions = await page.evaluate(() => ({
|
|
clientWidth: document.documentElement.clientWidth,
|
|
scrollWidth: document.documentElement.scrollWidth,
|
|
}));
|
|
expect(dimensions.scrollWidth).toBeLessThanOrEqual(dimensions.clientWidth);
|
|
await expect(page.getByRole("button", { name: /Ménú/ })).toBeVisible();
|
|
});
|
|
|
|
// UI-04. A fixed max-width clipped the selected value ("Light then",
|
|
// "라이트 테ㅁ"). The selector must be at least as wide as the browser's own
|
|
// width for its options, which depends on the font the machine has.
|
|
test("keeps the header selectors as wide as their options in every locale", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1280, height: 800 });
|
|
await page.goto("/");
|
|
const selectors = page.locator(
|
|
".theme-selector select, .locale-selector select",
|
|
);
|
|
await expect(selectors).toHaveCount(2);
|
|
|
|
for (const locale of ["ko-KR", "en-US", "en-XA"]) {
|
|
await page.locator(".locale-selector select").selectOption(locale);
|
|
await expect(page.locator("html")).toHaveAttribute("lang", locale);
|
|
const shortfalls = await selectors.evaluateAll((elements) =>
|
|
elements.map((element) => {
|
|
const select = element as HTMLSelectElement;
|
|
const actual = select.getBoundingClientRect().width;
|
|
const inline = select.style.cssText;
|
|
select.style.maxWidth = "none";
|
|
select.style.width = "auto";
|
|
const needed = select.getBoundingClientRect().width;
|
|
select.style.cssText = inline;
|
|
return Math.max(0, Math.round(needed - actual));
|
|
}),
|
|
);
|
|
expect(shortfalls, locale).toEqual([0, 0]);
|
|
}
|
|
});
|
|
|
|
// 08-07. The example screens stay outside the catalog on purpose, so their
|
|
// copy is Korean in every locale. Under en-US a screen reader would read that
|
|
// copy with English rules unless the screen names its own language.
|
|
test("marks the Korean-only example screens as Korean under another locale", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 1280, height: 800 });
|
|
await page.goto("/");
|
|
await page.getByRole("combobox", { name: "언어" }).selectOption("en-US");
|
|
await expect(page.locator("html")).toHaveAttribute("lang", "en-US");
|
|
const navigation = page.getByRole("navigation", { name: "Primary navigation" });
|
|
|
|
for (const label of [
|
|
"Platform composition",
|
|
"UI components",
|
|
"Screen states",
|
|
"Authentication",
|
|
]) {
|
|
await navigation.getByRole("link", { name: label }).click();
|
|
await expect(page).toHaveTitle(new RegExp(`^${label} `));
|
|
await expect(page.locator("main .ui-page").first(), label).toHaveAttribute(
|
|
"lang",
|
|
"ko-KR",
|
|
);
|
|
}
|
|
});
|
|
|
|
test("applies RTL to the shell and modal navigation without changing action semantics", async ({
|
|
page,
|
|
}) => {
|
|
await page.setViewportSize({ width: 390, height: 844 });
|
|
await page.goto("/");
|
|
await page.getByRole("combobox", { name: "언어" }).selectOption("ar-EG");
|
|
|
|
await expect(page.locator("html")).toHaveAttribute("lang", "ar-EG");
|
|
await expect(page.locator("html")).toHaveAttribute("dir", "rtl");
|
|
const trigger = page.getByRole("button", { name: "Menu" });
|
|
await trigger.click();
|
|
await expect(page.getByRole("dialog", { name: "Menu" })).toBeVisible();
|
|
await expect(page.getByRole("navigation", { name: "Primary navigation" }))
|
|
.toHaveCount(1);
|
|
await page.keyboard.press("Escape");
|
|
await expect(trigger).toBeFocused();
|
|
});
|