feat(i18n): localise application workspace

This commit is contained in:
cesnimda
2026-08-28 20:04:11 +02:00
parent cc01540446
commit a57b2fe58c
5 changed files with 372 additions and 124 deletions
@@ -149,6 +149,7 @@ function renderTable(path = "/jobs") {
}
beforeEach(() => {
window.localStorage.removeItem("uiLanguage");
mockedApi.get.mockImplementation((url: string) => {
if (url === "/companies") return Promise.resolve({ data: [{ id: 1, name: "Acme" }] } as any);
if (url === "/jobapplications") return Promise.resolve({ data: { items: [job], total: 1, page: 1, pageSize: 15 } } as any);
@@ -158,7 +159,10 @@ beforeEach(() => {
});
});
afterEach(() => jest.clearAllMocks());
afterEach(() => {
window.localStorage.removeItem("uiLanguage");
jest.clearAllMocks();
});
test("opens the dedicated workspace from the whole row and preserves list state on return", async () => {
renderTable();
@@ -227,6 +231,17 @@ test("warns before section navigation would discard application edits", async ()
await waitFor(() => expect(screen.getByTestId("location")).toHaveTextContent("/jobs/42?section=analysis"));
});
test("renders shared workspace navigation and progress in Norwegian Bokmål", async () => {
window.localStorage.setItem("uiLanguage", "nb");
renderTable("/jobs/42");
expect(await screen.findByRole("tab", { name: "Oversikt" })).toHaveAttribute("aria-selected", "true");
expect(screen.getByRole("tab", { name: "Analyse" })).toBeInTheDocument();
expect(screen.getByRole("tab", { name: "Søknadsbrev" })).toBeInTheDocument();
expect(await screen.findByLabelText(/søknadsprogresjon/i)).toBeInTheDocument();
expect(screen.getByRole("button", { name: /tilbake til søknader/i })).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");