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(); });