diff --git a/tests/component/app-shell.test.tsx b/tests/component/app-shell.test.tsx index da23dd48..b43a61d3 100644 --- a/tests/component/app-shell.test.tsx +++ b/tests/component/app-shell.test.tsx @@ -114,3 +114,19 @@ describe("app shell mobile navigation drawer", () => { await waitFor(() => expect(menuButton).toHaveFocus()); }); }); + +describe("app shell landmarks (08-09)", () => { + it("points the skip link at the main region and names the sidebar", async () => { + renderShell(); + + const main = await screen.findByRole("main"); + expect(main.id).not.toBe(""); + expect( + screen.getByRole("link", { name: "본문으로 건너뛰기" }), + ).toHaveAttribute("href", `#${main.id}`); + const sidebar = screen.getByRole("complementary", { name: "사이드바" }); + expect( + within(sidebar).getByRole("navigation", { name: "주요 탐색" }), + ).toBeVisible(); + }); +}); diff --git a/tests/component/async-surface.test.tsx b/tests/component/async-surface.test.tsx index 17cf151c..3be76c70 100644 --- a/tests/component/async-surface.test.tsx +++ b/tests/component/async-surface.test.tsx @@ -11,6 +11,7 @@ import { AccessSurface, EmptySurface, ErrorSummary, + LoadingSurface, TerminalErrorSurface, } from "../../src/presentation/design-system/index.ts"; import StateGalleryPage from "../../src/presentation/examples/state-gallery-page.tsx"; @@ -210,6 +211,14 @@ describe("async UI state matrix", () => { expect(action).toHaveBeenCalledOnce(); }); + it("announces a loading surface politely while it is busy (08-09)", () => { + render(); + + const surface = screen.getByRole("region", { name: "목록을 불러오는 중" }); + expect(surface).toHaveAttribute("aria-busy", "true"); + expect(surface).toHaveAttribute("aria-live", "polite"); + }); + it("renders an idle query as neither loading nor empty", () => { const { container, rerender } = render( content, diff --git a/tests/e2e/accessibility.spec.ts b/tests/e2e/accessibility.spec.ts index f2aca7e9..23c00bdc 100644 --- a/tests/e2e/accessibility.spec.ts +++ b/tests/e2e/accessibility.spec.ts @@ -61,6 +61,26 @@ test("@a11y keyboard reaches the primary route action with visible focus", async await expect(action).toHaveCSS("outline-style", "solid"); }); +// 08-09. axe's skip-link rule is best-practice, outside WCAG_TAGS, so the only +// way past the header and sidebar (WCAG 2.4.1) needs its own check. +test("@a11y skip link moves keyboard focus into main", async ({ page }) => { + await page.goto("/examples/ui"); + await expect(page.getByRole("heading", { level: 1 })).toBeFocused(); + const skipLink = page.getByRole("link", { name: "본문으로 건너뛰기" }); + await skipLink.focus(); + await expect(skipLink).toBeFocused(); + + await page.keyboard.press("Enter"); + + await expect + .poll(() => + page.evaluate( + () => document.querySelector("main")?.contains(document.activeElement) ?? false, + ), + ) + .toBe(true); +}); + test("@a11y reduced-motion policy disables long animation", async ({ page }) => { await page.emulateMedia({ reducedMotion: "reduce" }); await page.goto("/");