feat(ui): redesign job header and overview
This commit is contained in:
@@ -274,3 +274,48 @@ test("hydrates list filters, sort and page from a shareable URL", async () => {
|
||||
}),
|
||||
}));
|
||||
});
|
||||
|
||||
test("names the progress scroll region and identifies the current stage without making stages actions", async () => {
|
||||
renderTable("/jobs/42");
|
||||
const progress = await screen.findByRole("region", { name: "Application progress: Waiting" });
|
||||
expect(progress).toHaveAttribute("tabindex", "0");
|
||||
expect(within(progress).getByText("Waiting").closest("[aria-current]")).toHaveAttribute("aria-current", "step");
|
||||
expect(within(progress).queryByRole("button")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("keeps custom status literal without claiming a completed standard pipeline", async () => {
|
||||
mockedApi.get.mockResolvedValue({ data: { ...overview, status: "Faglig vurdering" } } as any);
|
||||
renderTable("/jobs/42");
|
||||
const progress = await screen.findByRole("region", { name: "Application progress: Faglig vurdering" });
|
||||
expect(within(progress).queryByText("Offer")).not.toBeInTheDocument();
|
||||
expect(await screen.findByRole("heading", { name: "Backend Developer" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("retries a failed workspace read without creating or changing application content", async () => {
|
||||
mockedApi.get.mockRejectedValueOnce({ response: { status: 503 } });
|
||||
renderTable("/jobs/42");
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Retry" }));
|
||||
expect(await screen.findByRole("heading", { name: "Backend Developer" })).toBeInTheDocument();
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("keeps the server-selected next action and preparation entry on the existing CV section", async () => {
|
||||
mockedApi.get.mockResolvedValue({ data: { ...overview, nextStep: { key: "prepare-cv", label: "Prepare a CV for this role", reason: "Attach the chosen variant.", section: "cv" } } } as any);
|
||||
renderTable("/jobs/42");
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Prepare a CV for this role" }));
|
||||
expect(await screen.findByText("CV section")).toBeInTheDocument();
|
||||
expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=cv");
|
||||
fireEvent.click(screen.getByRole("tab", { name: "Overview" }));
|
||||
fireEvent.click(await screen.findByRole("button", { name: "CV Not prepared" }));
|
||||
expect(await screen.findByText("CV section")).toBeInTheDocument();
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("uses recorded dates in the summary and keeps absent dates unknown", async () => {
|
||||
renderTable("/jobs/42");
|
||||
const summary = await screen.findByRole("region", { name: "Application information" });
|
||||
expect(summary).toHaveTextContent(new Date(overview.dateApplied).toLocaleDateString("en"));
|
||||
expect(within(summary).getAllByText("—")).toHaveLength(2);
|
||||
expect(screen.queryByRole("link", { name: "Open original advert" })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user