i18n 적용
This commit is contained in:
@@ -42,9 +42,9 @@ describe("DashboardPage - GNB와 테마", () => {
|
||||
|
||||
render(<DashboardPage />);
|
||||
|
||||
const dashboardLink = await screen.findByRole("link", { name: "대시보드" });
|
||||
const projectsLink = await screen.findByRole("link", { name: "프로젝트 목록" });
|
||||
const submissionsLink = await screen.findByRole("link", { name: "전체 제출 내역" });
|
||||
const dashboardLink = await screen.findByRole("link", { name: "Dashboard" });
|
||||
const projectsLink = await screen.findByRole("link", { name: "Projects" });
|
||||
const submissionsLink = await screen.findByRole("link", { name: "All submissions" });
|
||||
|
||||
expect(dashboardLink.getAttribute("href")).toBe("/dashboard");
|
||||
expect(dashboardLink.getAttribute("aria-current")).toBe("page");
|
||||
@@ -79,7 +79,7 @@ describe("DashboardPage - GNB와 테마", () => {
|
||||
const html = document.documentElement;
|
||||
html.classList.remove("dark");
|
||||
|
||||
const themeToggleButton = await screen.findByRole("button", { name: "테마 전환" });
|
||||
const themeToggleButton = await screen.findByRole("button", { name: "Toggle theme" });
|
||||
|
||||
expect(html.classList.contains("dark")).toBe(false);
|
||||
|
||||
@@ -91,4 +91,51 @@ describe("DashboardPage - GNB와 테마", () => {
|
||||
|
||||
expect(html.classList.contains("dark")).toBe(false);
|
||||
});
|
||||
|
||||
it("대시보드 요약 카드와 프로젝트 카드가 라이트/다크 테마에서 읽기 쉬운 텍스트 색상 클래스를 사용해야 한다", async () => {
|
||||
const overview = {
|
||||
summaryStats: {
|
||||
totalProjects: 1,
|
||||
totalSubmissions: 10,
|
||||
todaySubmissions: 2,
|
||||
last7DaysSubmissions: 5,
|
||||
},
|
||||
projectStats: [
|
||||
{
|
||||
projectId: "p1",
|
||||
title: "Test project 1",
|
||||
slug: "test-project-1",
|
||||
status: "DRAFT",
|
||||
totalSubmissions: 3,
|
||||
lastSubmissionAt: "2025-01-01T00:00:00.000Z",
|
||||
},
|
||||
],
|
||||
dailySubmissions: [],
|
||||
};
|
||||
|
||||
const fetchMock = vi.fn().mockResolvedValue(
|
||||
new Response(JSON.stringify(overview), {
|
||||
status: 200,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
}),
|
||||
);
|
||||
|
||||
vi.stubGlobal("fetch", fetchMock as any);
|
||||
|
||||
const { container } = render(<DashboardPage />);
|
||||
|
||||
// 요약 카드가 렌더링될 때까지 기다린다.
|
||||
await screen.findByTestId("dashboard-summary-total-projects");
|
||||
|
||||
const summaryCard = container.querySelector(
|
||||
'[data-testid="dashboard-summary-total-projects"]',
|
||||
) as HTMLElement | null;
|
||||
expect(summaryCard).not.toBeNull();
|
||||
|
||||
const summaryLabel = summaryCard!.querySelector("span") as HTMLElement | null;
|
||||
expect(summaryLabel).not.toBeNull();
|
||||
const summaryLabelClass = summaryLabel!.className;
|
||||
expect(summaryLabelClass).toContain("text-slate-500");
|
||||
expect(summaryLabelClass).toContain("dark:text-slate-400");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user