feat(jobs): persist list state in URL
This commit is contained in:
@@ -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§ion=match");
|
||||
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend&workspace=42§ion=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§ion=match");
|
||||
expect(screen.getByTestId("location")).toHaveTextContent("/jobs?q=backend&workspace=42§ion=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",
|
||||
}),
|
||||
}));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user