공통 primitive가 디자인 시스템 설계 8.1·8.2절과 WCAG 2.2 AA 약속을 어긴다. - Popover가 이름 없는 role="dialog"를 그린다(1112/05-10). - Dialog 안의 Menu·Popover·Tooltip에서 Escape를 누르면 Dialog까지 닫힌다. Dialog가 안쪽이 처리한 Escape를 보지 않는다(05-11). - SearchField는 required 기호만, Checkbox는 상태만 있다(05-13). - Toast를 닫기 버튼으로 닫으면 포커스가 body로 떨어진다(05-14). - TextArea 글자 수가 <output>(암묵 status)이라 글자마다 발표되고 입력과 이어지지 않는다(05-17). - 라우트 h1의 :focus outline 제거가 layer 순서로 키보드 :focus-visible 표시까지 지운다(05-02). Tooltip이 pointer-events: none과 틈 때문에 포인터를 설명 위로 옮기면 사라진다(1.4.13, 05-06). - 홈 readiness 목록이 role 없는 div에 aria-label을 단다(05-15). - fe-a11y·fe-ux 스킬이 제출 실패 때 오류 요약으로 포커스가 간다고 적는다. 코드는 첫 오류 필드로 보낸다(05-09). 고른 방법: Popover는 trigger id로 이름을 받는다. Popover·Tooltip은 Escape를 capture 단계에서 받아 preventDefault하고, Dialog는 기본 동작이 막힌 Escape(과 그 뒤 cancel)를 넘긴다. Tooltip은 보일 때(hover·focus)만 Escape를 가진다. 숨은 tooltip이 다른 Dialog의 Escape를 막지 않게 하려는 것이다. Toast 닫기는 다음 toast의 닫기 버튼, 없으면 toast로 들어오기 전 요소로 포커스를 돌린다. TextArea 글자 수는 aria-describedby로 잇고 0에 닿을 때만 따로 발표한다. h1은 :focus:not(:focus-visible)만 outline을 지운다. Tooltip은 보일 때만 포인터를 받고 ::before 다리로 틈을 메운다. 버린 대안: Dialog가 안쪽 layer 목록을 들고 Escape를 나누기(primitive끼리 묶인다). 위험·한계: native <dialog>가 막힌 keydown 뒤에도 cancel을 쏘는지는 브라우저마다 다를 수 있어, Dialog는 같은 task의 cancel 하나를 넘긴다. Toast가 돌려줄 요소가 지워졌으면 포커스를 옮기지 않는다. 시각 골든이 바뀌는지는 desktop test:visual로 본다. 검증: 새 component 시험(tests/component/design-system-a11y.test.tsx, starter-pages), e2e(app-shell focus ring, 세 엔진), storybook(tooltip hover)의 RED·GREEN은 desktop에서 돌려 PR 본문에 적는다. Refs: 1112/05-02, 1112/05-06, 1112/05-09, 1112/05-10, 1112/05-11, 1112/05-13, 1112/05-14, 1112/05-15, 1112/05-17
95 lines
3.1 KiB
TypeScript
95 lines
3.1 KiB
TypeScript
// @vitest-environment jsdom
|
|
|
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { MemoryRouter } from "react-router-dom";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
import { formatMessage, LocaleProvider } from "../../src/presentation/i18n/index.ts";
|
|
import HomePage from "../../src/presentation/pages/home-page.tsx";
|
|
import { ApplicationProvider } from "../../src/presentation/providers/application-provider.tsx";
|
|
import { PreferenceProviders } from "../../src/presentation/providers/preference-providers.tsx";
|
|
import { AppRouter } from "../../src/presentation/routes/app-router.tsx";
|
|
import { createTestApplication } from "../helpers/create-test-application.ts";
|
|
|
|
/**
|
|
* The starter screens (`/` and `/examples/platform`) are the template's
|
|
* content, not the platform (0929/10-02). A product that replaces them deletes
|
|
* the `starter-*.test.tsx` files with them; the platform tests run on the
|
|
* test-only feature's pages and keep passing. 1103/09-04: the other example
|
|
* screens are a removable feature, tested in its own test folder.
|
|
*/
|
|
|
|
function renderApp(
|
|
url: string,
|
|
application = createTestApplication(),
|
|
) {
|
|
window.history.pushState({}, "", url);
|
|
return render(
|
|
<ApplicationProvider application={application}>
|
|
<PreferenceProviders>
|
|
<AppRouter />
|
|
</PreferenceProviders>
|
|
</ApplicationProvider>,
|
|
);
|
|
}
|
|
|
|
describe("starter home page", () => {
|
|
// 1112/05-15. A generic div's aria-label is dropped by assistive technology;
|
|
// the readiness list is a named group.
|
|
it("names the readiness list as a group", async () => {
|
|
renderApp("/");
|
|
|
|
expect(
|
|
await screen.findByRole("group", { name: formatMessage("ko-KR", "home.readiness") }),
|
|
).toBeVisible();
|
|
});
|
|
|
|
it("reaches the platform overview from the starter actions", async () => {
|
|
const user = userEvent.setup();
|
|
renderApp("/");
|
|
|
|
await user.click(
|
|
await screen.findByRole("link", { name: "플랫폼 구성 보기" }),
|
|
);
|
|
|
|
await waitFor(() =>
|
|
expect(
|
|
screen.getByRole("heading", { name: "플랫폼 구성", level: 1 }),
|
|
).toHaveFocus(),
|
|
);
|
|
});
|
|
|
|
it("stops the release summary from loading forever", async () => {
|
|
render(
|
|
<ApplicationProvider
|
|
application={createTestApplication({
|
|
releaseInfo: {
|
|
getCurrent: async () => {
|
|
throw new Error("manifest unavailable");
|
|
},
|
|
refresh: async () => {
|
|
throw new Error("manifest unavailable");
|
|
},
|
|
},
|
|
})}
|
|
>
|
|
<LocaleProvider>
|
|
{/* HomePage renders router links, so it needs a router but not the app one. */}
|
|
<MemoryRouter>
|
|
<HomePage />
|
|
</MemoryRouter>
|
|
</LocaleProvider>
|
|
</ApplicationProvider>,
|
|
);
|
|
await waitFor(() =>
|
|
expect(
|
|
screen.getByText("런타임 정보를 확인하지 못했습니다."),
|
|
).toBeVisible(),
|
|
);
|
|
expect(
|
|
screen.queryByText("검증된 런타임 정보를 확인하고 있습니다."),
|
|
).not.toBeInTheDocument();
|
|
});
|
|
});
|