셸 동작을 보는 e2e(반응형, 스크롤 복원, 해시 링크, 타이포그래피, 건너뛰기 링크, 메뉴 이동, 운영 CSP, compact, en-US의 lang)가 지울 예제 화면을 열거나 그 메뉴를 누른다. 홈과 /examples/platform으로 옮겼다. 스크롤 복원은 계약 표가 그려진 뒤 스크롤하고, 해시 링크는 비동기 표보다 위에 있는 첫 절을 대상으로 한다. WebKit은 scroll anchoring이 없어 표 아래 대상이 1px 밀렸다. 갤러리 자체의 320px 리플로는 앞 커밋의 workshop 시험이 맡는다. 위험: 홈과 플랫폼 개요의 모양이 바뀌면 이 시험들의 대상도 바뀐다. 검증(desktop): 샘플을 지운 최종 트리에서 test:e2e 183 passed.
98 lines
4.1 KiB
TypeScript
98 lines
4.1 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 platform overview stays outside the catalog on purpose, so its
|
|
// 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. (The
|
|
// example screens that shared this rule were deleted on 2026-11-07; the
|
|
// galleries are workshop stories.)
|
|
test("marks the Korean-only platform overview 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"]) {
|
|
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();
|
|
});
|