feat(jobs): persist list state in URL
CI and Deploy / test (pull_request) Successful in 4m55s
CI and Deploy / deploy (pull_request) Has been skipped

This commit is contained in:
cesnimda
2026-08-15 13:00:27 +02:00
parent b67a531af4
commit bd5362c8c2
6 changed files with 183 additions and 47 deletions
@@ -118,21 +118,21 @@ test("opens the workspace in a route-backed overlay and preserves list state thr
fireEvent.click(await screen.findByRole("button", { name: /open: backend developer/i }));
await screen.findByRole("dialog", { name: /application workspace/i });
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?workspace=42");
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend&workspace=42");
expect(screen.getByRole("link", { name: /open full-page workspace/i })).toHaveAttribute("href", "/applications/42?section=overview");
fireEvent.click(screen.getByRole("button", { name: "Match" }));
expect(await screen.findByText("Match section")).toBeInTheDocument();
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?workspace=42&section=match");
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend&workspace=42&section=match");
fireEvent.click(screen.getByRole("button", { name: /back to applications/i }));
await waitFor(() => expect(screen.queryByRole("dialog", { name: /application workspace/i })).not.toBeInTheDocument());
expect(screen.getByTestId("location")).toHaveTextContent("/jobs");
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend");
expect(screen.getByRole("textbox", { name: /search/i })).toHaveValue("backend");
fireEvent.click(screen.getByRole("button", { name: /browser forward/i }));
await screen.findByRole("dialog", { name: /application workspace/i });
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?workspace=42&section=match");
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend&workspace=42&section=match");
});
test("opens a direct workspace URL and closes it without inventing browser history", async () => {
@@ -145,3 +145,22 @@ test("opens a direct workspace URL and closes it without inventing browser histo
await waitFor(() => expect(screen.getByTestId("location")).toHaveTextContent("/jobs"));
await waitFor(() => expect(screen.queryByRole("dialog", { name: /application workspace/i })).not.toBeInTheDocument());
});
test("hydrates list filters, sort and page from a shareable URL", async () => {
renderTable("/jobs?q=backend&status=Interview&companyId=1&location=Oslo&needsFollowUp=1&readiness=interview&includeDeleted=1&sortBy=company&sortDir=asc&page=2");
expect(await screen.findByRole("textbox", { name: /search/i })).toHaveValue("backend");
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith("/jobapplications", {
params: expect.objectContaining({
page: 2,
q: "backend",
status: "Interview",
companyId: 1,
location: "Oslo",
needsFollowUp: true,
includeDeleted: true,
sortBy: "company",
sortDir: "asc",
}),
}));
});