feat(i18n): localise document editing controls

This commit is contained in:
cesnimda
2026-08-28 20:06:01 +02:00
parent a57b2fe58c
commit 50f276c6c0
4 changed files with 59 additions and 9 deletions
+19 -1
View File
@@ -66,7 +66,12 @@ function routeGet(overrides: Record<string, any> = {}) {
});
}
beforeEach(() => jest.clearAllMocks());
beforeEach(() => {
window.localStorage.removeItem("uiLanguage");
jest.clearAllMocks();
});
afterEach(() => window.localStorage.removeItem("uiLanguage"));
// ---------- CV ----------
@@ -185,6 +190,19 @@ test("an empty cover letter offers the template and an empty history", async ()
.toContain("Dear Hiring Manager");
});
test("the empty cover-letter template and rich-text controls follow Bokmål UI language", async () => {
window.localStorage.setItem("uiLanguage", "nb");
routeGet({ coverLetter: { text: null, currentVersion: 0, versions: [], aiSuggestionCount: 0 } });
render(<ApplicationCoverLetterSection jobId={7} />);
fireEvent.click(await screen.findByRole("button", { name: /start fra mal/i }));
expect((screen.getByLabelText("Søknadsbrev") as HTMLTextAreaElement).value)
.toContain("Kjære rekrutteringsansvarlig");
expect(screen.getByRole("button", { name: "Fet" })).toBeInTheDocument();
expect(screen.getByRole("button", { name: "Lenke" })).toBeInTheDocument();
});
test("AI cover letter suggestions use the linked CV and require explicit apply", async () => {
routeGet();
mockedApi.post.mockResolvedValue({