Compare commits

..

1 Commits

Author SHA1 Message Date
cesnimda 86d2305e64 fix(a11y): announce singular calendar and search counts
Preserve the real result count and localized date. Zero and multiple entries keep the existing translations. The Bokmål search noun has the same form in both cases.

Verified from f6143b9c with 37 component tests and six isolated Chromium/SQLite journeys on ports 4397/5397. New zero/one/two checks reproduced three singular failures before the fix. Next static export, TypeScript and scoped lint passed.
2026-11-20 19:30:45 +01:00
13 changed files with 43 additions and 206 deletions
@@ -32,21 +32,3 @@ The library now compares the name shown in the dialog with the name returned by
**Evidence scope.** The tests render the real library and prompt with mocked transport. A native two-tab/browser run, real database writes, PDF rendering and full integrated acceptance were outside this execution. The earlier 85-case verification above is historical. The changed library source blob is `4b5018c6e549a4c5711dcc84a00082629af0ef80` and test blob is `448f46e977f4c733b3d99265e500fed8ee7779bf`.
The AST-only Graphify refresh completed with 20,198 nodes and 50,033 edges. SQL extraction was unavailable and 146 source files yielded no symbols.
## Native two-tab rename and SQLite readback · 20 November 2026
Application source `89128e1c33378bf2c65f2f28b048a63957772eb7`. Two Chromium tabs shared a signed-in synthetic owner and the same CV. Tab one opened Rename on revision 1. Tab two renamed the CV through its library and committed revision 2. Tab one submitted its still-open draft, saw the conflict and the persisted name, and issued **zero PUTs**. After the owner reopened Rename and reviewed that name, tab one issued exactly one PUT with expected revision 2. A reload in tab two displayed the reviewed name. The variant and history APIs returned revisions 1, 2, 3. A separate read-only SQLite query against the disposable database verified exactly those three rows and identical stored settings at each revision.
**Passed.** Two native cases ran with one worker, zero retries, zero skips and zero flaky results. The new pre-read conflict case took 7.7 s. The existing post-read race took 4.7 s and received the real server 409 before an explicit retry. Both used a freshly built .NET 9.0.317 Release API, a unique local SQLite data root and a fresh static export. The .NET build had zero warnings or errors. The exact-lock Next 16.4.6 build completed compilation, TypeScript and static generation. The three component suites passed all 77 cases on the same dependencies; these overlap the 77 earlier cases. Scoped ESLint, whitespace and the AST refresh passed (20,199 nodes and 50,038 edges).
**Build recovery.** The initial webpack attempt used a cross-drive dependency junction which resolved Next 16.4.1 and failed module resolution. An independent offline `npm ci` installed 806 packages from the lockfile. The successful runs used Next 16.4.6, Jest 30.4.2 and Playwright 1.62.1. The npm log retained dependency deprecation notices and a pending install script for the resolver. No dependency versions changed. The local API emitted its existing SQLite migration and development key-storage warnings. This run did not qualify production migrations, backup/restore or key storage.
| Evidence | Identity |
| --- | --- |
| New browser test, Git blob | `a57a77d87a377ae26ac0869469ab04732d93249b` |
| Dependency lock, Git blob | `4c277d454e1164b1e24f21f463b5251052e53eaa` |
| Playwright JSON, SHA-256 | `861352d6c00beb09d6e7fee5f0e596992d4eb2658fe07a65c0599f81e344ad10` |
| Pinned Jest JSON, SHA-256 | `b6b5fd043f750e5a979f5ba70f81c86e314303eaaf707339b3fbc490a06d980b` |
| Static export index / Release API DLL, SHA-256 | `78a5db16a0e85d8f3ead4cb6431d7fd021148b6d02d38007a4701769fb9f7e39` / `769e32f5c4f8bac61743dce67748dd5198cbbc472c8c6c1630ccefe81a1c91d2` |
Raw receipts are under `E:/Storage/Projects/Active/temp docs/jobjakt-local-build/cv-library-rename-verification/`. Reproduce with the existing isolated static-export Playwright configuration and `phase7-cv-library.spec.ts --grep 'two library tabs|concurrent rename receives ordinary409' --workers=1 --retries=0`. Both loopback servers stopped at completion. Browser coverage was desktop Chromium in English, on synthetic local SQLite records. MariaDB, human/device checks, PDF rendering, full A3, integrated security and release acceptance remain open.
@@ -10,8 +10,6 @@ python -m http.server 4327 --bind 127.0.0.1 --directory docs/ui-modernisation/re
## Compare the experiences
Browser Back and Forward retrace screens and selected opportunities within a concept. For example, open a filtered job, enter its CV workspace and go back twice to return to the filtered results. The ten desktop/phone selected-job journeys exercised this round trip and its forward path on 20 November. Drafts and filters are held in memory for the review session.
| Direction | First interaction | Desktop and phone | Implementation implication |
| --- | --- | --- | --- |
| A · Clear Desk | Scan the activity list and agenda | Compact top navigation, high density, horizontally scrollable on a phone | Existing tracker and agenda owners fit. Check legibility as text size increases. |
@@ -1,4 +1,5 @@
const $ = (s) => document.querySelector(s);
const $ = (s) => document.querySelector(s),
q = new URLSearchParams(location.search);
const screens = [
"home",
"discover",
@@ -13,20 +14,14 @@ const screens = [
"admin",
"onboarding",
];
function routeFromLocation() {
const query = new URLSearchParams(location.search);
const selected = (key, allowed, fallback) =>
allowed.includes(query.get(key)) ? query.get(key) : fallback;
return {
concept: selected("concept", "ABCDE".split(""), ""),
screen: selected("screen", screens, "home"),
lang: selected("lang", ["en", "nb"], "en"),
theme: selected("theme", ["light", "dark"], "light"),
phone: query.get("mobile") === "1",
};
}
const selected = (key, allowed, fallback) =>
allowed.includes(q.get(key)) ? q.get(key) : fallback;
const state = {
...routeFromLocation(),
concept: selected("concept", "ABCDE".split(""), ""),
screen: selected("screen", screens, "home"),
lang: selected("lang", ["en", "nb"], "en"),
theme: selected("theme", ["light", "dark"], "light"),
phone: q.get("mobile") === "1",
calendarView: "agenda",
trackerView: "list",
query: "",
@@ -348,11 +343,7 @@ const records = jobs.map((job, i) => ({
function trackedCount() {
return records.filter((r) => r.stage === "saved").length;
}
function jobFromLocation() {
const id = new URLSearchParams(location.search).get("job");
return records.find((r) => r.id === id) || records[0];
}
let current = jobFromLocation();
let current = records.find((r) => r.id === q.get("job")) || records[0];
const detailText = [
[
"Coordinate community care, support families and work with local healthcare teams.",
@@ -559,7 +550,7 @@ function gallery() {
"",
)}</div><section style="margin-top:45px"><h2>What to compare</h2><p>Try finding a job, saving it, preparing a CV, reviewing a letter and scheduling a follow-up. Switch between desktop and mobile, English and Bokmål, light and dark. These are design prototypes with synthetic data, not provider or production qualification.</p><a href="compare.html">Compare screenshots and tradeoffs</a> · <a href="RESEARCH.md">Research notes</a></section></main>`;
}
function render(navigating = false) {
function render() {
if (!state.concept) {
$("#app").innerHTML = gallery();
return;
@@ -616,26 +607,20 @@ function render(navigating = false) {
.join(
"",
)}</select></label><label><select aria-label="Language" id="lang"><option value="en" ${state.lang === "en" ? "selected" : ""}>English</option><option value="nb" ${state.lang === "nb" ? "selected" : ""}>Norsk</option></select></label><button data-action="theme">${state.theme === "dark" ? "☀ Light" : "☾ Dark"}</button><button data-action="mobile">${state.phone ? t("desktop") : t("mobile")}</button></div><div class="shell"><header class="top"><a class="brand" href="#" data-screen="home"><span>${state.concept === "E" ? "↗" : "j"}</span>${c.name}</a><nav class="nav" aria-label="Primary">${nav.map((s) => link(s, t(s), state.screen === s ? "active" : "")).join("")}</nav><div class="actions">${link("mail", "✉ " + t("mail"))}${link("settings", t("settings"))}<span class="avatar">AO</span></div></header><main class="content" id="main">${(screens[state.screen] || home)()}<details style="margin-top:35px"><summary>${t("help")}</summary><div class="actions" style="margin-top:12px">${["cv", "letter", "mail", "settings", "admin", "onboarding"].map((s) => link(s, t(s))).join("")}</div></details></main>${state.concept === "E" ? `<nav class="journey-nav" aria-label="Journey">${["home", "discover", "applications", "profile", "calendar"].map((s) => link(s, t(s), state.screen === s ? "active" : "")).join("")}</nav>` : ""}</div><footer class="footnote">${t("synthetic")}</footer>`;
const search = `?concept=${state.concept}&screen=${state.screen}&lang=${state.lang}&theme=${state.theme}&job=${current.id}${state.phone ? "&mobile=1" : ""}`;
if (search !== location.search) {
if (navigating) history.pushState(null, "", search);
else history.replaceState(null, "", search);
}
history.replaceState(
null,
"",
`?concept=${state.concept}&screen=${state.screen}&lang=${state.lang}&theme=${state.theme}&job=${current.id}${state.phone ? "&mobile=1" : ""}`,
);
}
window.addEventListener("popstate", () => {
Object.assign(state, routeFromLocation());
current = jobFromLocation();
render();
});
document.addEventListener("click", (event) => {
const a = event.target.closest("[data-screen]");
if (a) {
if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
event.preventDefault();
if (a.dataset.job)
current = records.find((r) => r.id === a.dataset.job) || records[0];
state.screen = a.dataset.screen;
render(true);
render();
window.scrollTo(0, 0);
return;
}
@@ -645,7 +630,7 @@ document.addEventListener("click", (event) => {
if (screens.includes(action)) {
if (state.screen === "home" && action === "detail") current = records[0];
state.screen = action;
render(true);
render();
window.scrollTo(0, 0);
} else if (action === "theme") {
state.theme = state.theme === "light" ? "dark" : "light";
@@ -674,7 +659,7 @@ document.addEventListener("click", (event) => {
current.followup = true;
state.calendarView = "agenda";
state.screen = "calendar";
render(true);
render();
toast(
state.lang === "nb"
? "Oppfølging lagt til i prototypen"
@@ -721,7 +706,7 @@ document.addEventListener("change", (e) => {
}
if (["concept", "screen", "lang"].includes(e.target.id)) {
state[e.target.id] = e.target.value;
render(e.target.id !== "lang");
render();
}
if (e.target.id === "settingLanguage") {
state.lang = e.target.value;
@@ -5,7 +5,6 @@
"width": 1440,
"lang": "en",
"theme": "light",
"historyRoundTrip": true,
"passed": true
},
{
@@ -13,7 +12,6 @@
"width": 390,
"lang": "nb",
"theme": "dark",
"historyRoundTrip": true,
"passed": true
},
{
@@ -21,7 +19,6 @@
"width": 1440,
"lang": "en",
"theme": "light",
"historyRoundTrip": true,
"passed": true
},
{
@@ -29,7 +26,6 @@
"width": 390,
"lang": "nb",
"theme": "dark",
"historyRoundTrip": true,
"passed": true
},
{
@@ -37,7 +33,6 @@
"width": 1440,
"lang": "en",
"theme": "light",
"historyRoundTrip": true,
"passed": true
},
{
@@ -45,7 +40,6 @@
"width": 390,
"lang": "nb",
"theme": "dark",
"historyRoundTrip": true,
"passed": true
},
{
@@ -53,7 +47,6 @@
"width": 1440,
"lang": "en",
"theme": "light",
"historyRoundTrip": true,
"passed": true
},
{
@@ -61,7 +54,6 @@
"width": 390,
"lang": "nb",
"theme": "dark",
"historyRoundTrip": true,
"passed": true
},
{
@@ -69,7 +61,6 @@
"width": 1440,
"lang": "en",
"theme": "light",
"historyRoundTrip": true,
"passed": true
},
{
@@ -77,7 +68,6 @@
"width": 390,
"lang": "nb",
"theme": "dark",
"historyRoundTrip": true,
"passed": true
}
],
@@ -111,18 +111,8 @@ async function verify() {
await page.locator("#summary").inputValue(),
"Field electrician CV.",
);
await page.goBack();
assert.equal(new URL(page.url()).searchParams.get("screen"), "detail");
assert.equal(await page.locator("main h1").innerText(), "Front-of-house supervisor");
await page.goBack();
assert.equal(await page.locator("#country").inputValue(), "Denmark");
assert.equal(await page.locator("#search").inputValue(), "supervisor");
await page.goForward();
assert.equal(await page.locator("main h1").innerText(), "Front-of-house supervisor");
await page.goForward();
assert.match(await page.locator("main .heading").innerText(), /Harbour House/);
assert.deepEqual(errors, []);
results.push({ concept, width, lang, theme, historyRoundTrip: true, passed: true });
results.push({ concept, width, lang, theme, passed: true });
await page.close();
}
}
+1 -55
View File
@@ -1,7 +1,7 @@
import { expect, test as base, type APIRequestContext, type APIResponse, type Page, type Response, type TestInfo } from '@playwright/test';
import AxeBuilder from '@axe-core/playwright';
import { translations } from '../src/i18n/translations';
import type { CvTheme, CvVariant, CvVariantSummary, CvVariantVersionInfo } from '../src/cvBuilder';
import type { CvTheme, CvVariant, CvVariantSummary } from '../src/cvBuilder';
import { emptyStructuredCv } from '../src/profileCv';
import { readFile } from 'node:fs/promises';
import { createHash } from 'node:crypto';
@@ -416,60 +416,6 @@ test('[P7-04 PRES-C05 C07 C10 W07] keyboard rename duplicate and delete persist
sourceUnchanged: true, frozenUnchanged: true, qualification: 'Actual HTTP rename/duplicate/delete and frozen DTO readback; held duplicate continues the real request. Frozen DTO equality is not archived PDF-byte or restore qualification.' }), contentType: 'application/json' });
});
test('[P7-04 PRES-C05 C10] two library tabs preserve a concurrent name and allow an explicit retry', async ({ page, context, owner }, info) => {
const original = await createVariant(page.request, owner, 'Two-tab source CV');
const variantUrl = `${apiUrl}/cv/variants/${original.id}`;
const versions = async () => (await json<CvVariantVersionInfo[]>(await page.request.get(`${variantUrl}/versions`)))
.map(item => item.version).sort((left, right) => left - right);
const originalVersions = await versions();
const secondTab = await context.newPage();
const label = translations.en.cvDashboardRename;
const firstChoice = 'CV for school applications';
const secondChoice = 'CV for tutoring applications';
const writes: number[] = [];
page.on('request', request => {
if (request.url() === variantUrl && request.method() === 'PUT') writes.push(request.postDataJSON().expectedVersion);
});
const submit = (tab: Page) => tab.getByRole('dialog').getByRole('button', { name: label, exact: true }).click();
const saved = (tab: Page) => tab.waitForResponse(response => response.url() === variantUrl && response.request().method() === 'PUT');
await enter(page, owner);
await enter(secondTab, owner);
await openAction(page, original.name, label);
await page.getByRole('dialog').getByRole('textbox').fill(firstChoice);
await openAction(secondTab, original.name, label);
await secondTab.getByRole('dialog').getByRole('textbox').fill(secondChoice);
const [otherResponse] = await Promise.all([saved(secondTab), submit(secondTab)]);
const other = await json<CvVariant>(otherResponse);
expect(other).toMatchObject({ name: secondChoice, settings: original.settings, version: original.version + 1 });
await expect(card(secondTab, secondChoice)).toBeVisible();
await submit(page);
await expect(page.getByRole('alert').filter({ hasText: translations.en.cvEditorConflict })).toBeVisible();
await expect(card(page, secondChoice)).toBeVisible();
expect(writes).toEqual([]);
expect(await json<CvVariant>(await page.request.get(variantUrl))).toEqual(other);
expect(await versions()).toEqual([...originalVersions, other.version]);
await openAction(page, secondChoice, label);
const retry = page.getByRole('dialog').getByRole('textbox');
await expect(retry).toHaveValue(secondChoice);
await retry.fill(firstChoice);
const [retryResponse] = await Promise.all([saved(page), submit(page)]);
const reviewed = await json<CvVariant>(retryResponse);
expect(writes).toEqual([other.version]);
expect(reviewed).toMatchObject({ name: firstChoice, settings: original.settings, version: other.version + 1 });
expect(await json<CvVariant>(await page.request.get(variantUrl))).toEqual(reviewed);
expect(await versions()).toEqual([...originalVersions, other.version, reviewed.version]);
await secondTab.reload();
await expect(card(secondTab, firstChoice)).toBeVisible();
await info.attach('two-tab-rename-readback', { body: JSON.stringify({
initialVersion: original.version, secondTabVersion: other.version, firstTabPutPreconditions: writes,
finalVersion: reviewed.version, history: await versions(),
}), contentType: 'application/json' });
});
test('[P7-04 PRES-C05 C10] concurrent rename receives ordinary409 and requires owner review before a new save', async ({ page, owner }, info) => {
const sourceBefore = await seedSource(page, owner);
const original = await createVariant(page.request, owner, 'Recorded conflict CV');
-15
View File
@@ -1,15 +0,0 @@
import { parseISO } from "date-fns";
export function storedCalendarDay(value?: string | null): string {
if (!value || !/^\d{4}-\d{2}-\d{2}(?:T|$)/.test(value) || Number.isNaN(+parseISO(value))) return "";
return value.slice(0, 10);
}
export function formatStoredCalendarDay(value: string | null | undefined, locale: string): string {
const day = storedCalendarDay(value);
return day ? new Date(day).toLocaleDateString(locale, { timeZone: "UTC" }) : "";
}
export function saveCalendarDay(day: string, original?: string | null): string | null {
return day ? (day === storedCalendarDay(original) ? original! : day) : null;
}
@@ -19,31 +19,6 @@ beforeEach(() => {
window.localStorage.clear();
});
test.each([
"2026-11-23",
"2026-11-23T23:30:00Z",
"2026-11-23T00:30:00+14:00",
"2026-11-23T00:00:00",
null,
"2026-02-30",
])("preserves the stored company day in the table and editor for %s", async nextContactAt => {
const company = { id: 3, name: "Acme", nextContactAt };
const day = nextContactAt?.startsWith("2026-11-23") ? "2026-11-23" : "";
mockedApi.get.mockResolvedValue({ data: [company] });
mockedApi.put.mockResolvedValue({ data: company });
render(<I18nProvider><ToastProvider><MemoryRouter><CompaniesTable /></MemoryRouter></ToastProvider></I18nProvider>);
const edit = await screen.findByRole("button", { name: "Edit: Acme" });
const table = screen.getByRole("row", { name: /Acme/ });
if (day) expect(table).toHaveTextContent("11/23/2026");
else expect(table).not.toHaveTextContent(/Invalid Date|3\/2\/2026/);
fireEvent.click(edit);
const dialog = await screen.findByRole("dialog");
expect(within(dialog).getByLabelText("Next contact")).toHaveValue(day);
fireEvent.click(within(dialog).getByRole("button", { name: "Save" }));
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledWith("/companies/3",
expect.objectContaining({ nextContactAt: day ? nextContactAt : null })));
});
test("opens one company relationship view with applications and recent contact", async () => {
const company = { id: 3, name: "Acme", recruiterName: "Rita", recruiterEmail: "rita@example.test" };
mockedApi.get.mockImplementation((url) => Promise.resolve({ data: String(url).endsWith("/relationship") ? {
@@ -67,7 +42,7 @@ test.each(["en", "nb"])("company contact dates follow the %s UI locale", async (
const nextContactAt = "2026-11-23T12:00:00Z";
mockedApi.get.mockResolvedValue({ data: [{ id: 3, name: "Acme", nextContactAt, pipelineStage: "Interview" }] });
render(<I18nProvider><ToastProvider><MemoryRouter><CompaniesTable /></MemoryRouter></ToastProvider></I18nProvider>);
const expected = new Date(nextContactAt).toLocaleDateString(language === "nb" ? "nb-NO" : "en", { timeZone: "UTC" });
const expected = new Date(nextContactAt).toLocaleDateString(language === "nb" ? "nb-NO" : "en");
await screen.findByRole("button", { name: `${language === "nb" ? "Rediger" : "Edit"}: Acme` });
expect(screen.getByRole("row", { name: /Acme/ })).toHaveTextContent(expected);
expect(screen.getByRole("row", { name: /Acme/ })).toHaveTextContent("Interview");
@@ -24,7 +24,6 @@ import {
import useMediaQuery from "@mui/material/useMediaQuery";
import { api, getApiErrorMessage } from "../api";
import { formatStoredCalendarDay, saveCalendarDay, storedCalendarDay } from "../calendarDay";
import ViewStateNotice from "./ViewStateNotice";
import { Company } from "../types";
import EditOutlinedIcon from "@mui/icons-material/EditOutlined";
@@ -108,8 +107,8 @@ export default function CompaniesTable() {
setRecruiterEmail(c.recruiterEmail ?? "");
setRecruiterLinkedIn(c.recruiterLinkedIn ?? "");
setPipelineStage(c.pipelineStage ?? "");
setLastContactedAt(storedCalendarDay(c.lastContactedAt));
setNextContactAt(storedCalendarDay(c.nextContactAt));
setLastContactedAt((c.lastContactedAt ?? "").slice(0, 10));
setNextContactAt((c.nextContactAt ?? "").slice(0, 10));
setEditOpen(true);
};
@@ -157,8 +156,8 @@ export default function CompaniesTable() {
recruiterEmail: recruiterEmail.trim() || null,
recruiterLinkedIn: recruiterLinkedIn.trim() || null,
pipelineStage: pipelineStage.trim() || null,
lastContactedAt: saveCalendarDay(lastContactedAt, editing.lastContactedAt),
nextContactAt: saveCalendarDay(nextContactAt, editing.nextContactAt),
lastContactedAt: lastContactedAt || null,
nextContactAt: nextContactAt || null,
});
companiesResource.setData((prev) => prev.map((x) => (x.id === res.data.id ? res.data : x)));
@@ -213,7 +212,7 @@ export default function CompaniesTable() {
{renderCompanyMeta(t("companiesSource"), c.source)}
{renderCompanyMeta(t("companiesPipeline"), c.pipelineStage)}
{renderCompanyMeta(t("companiesRecruiter"), [c.recruiterName, c.recruiterEmail].filter(Boolean).join(" · "))}
{renderCompanyMeta(t("companiesNextContact"), formatStoredCalendarDay(c.nextContactAt, language === "nb" ? "nb-NO" : "en") || null)}
{renderCompanyMeta(t("companiesNextContact"), c.nextContactAt ? new Date(c.nextContactAt).toLocaleDateString(language === "nb" ? "nb-NO" : "en") : null)}
</Box>
</Stack>
</Paper>
@@ -249,7 +248,7 @@ export default function CompaniesTable() {
{c.recruiterName ?? ""}
{c.recruiterEmail ? ` (${c.recruiterEmail})` : ""}
</TableCell>
<TableCell sx={{ whiteSpace: "nowrap" }}>{formatStoredCalendarDay(c.nextContactAt, language === "nb" ? "nb-NO" : "en")}</TableCell>
<TableCell sx={{ whiteSpace: "nowrap" }}>{c.nextContactAt ? new Date(c.nextContactAt).toLocaleDateString(language === "nb" ? "nb-NO" : "en") : ""}</TableCell>
<TableCell align="right" sx={{ whiteSpace: "nowrap" }}>
<IconButton size="small" data-company-relationship={c.id} aria-label={`${t("companiesRelationship")}: ${c.name}`} onClick={() => void openRelationship(c)}>
<PeopleAltOutlinedIcon fontSize="small" />
@@ -369,8 +368,8 @@ export default function CompaniesTable() {
<Stack spacing={2} sx={{ mt: 0.5 }}>
<Box sx={{ display: "grid", gridTemplateColumns: { xs: "1fr", sm: "repeat(3, minmax(0, 1fr))" }, gap: 1.5 }}>
{renderCompanyMeta(t("companiesRecruiter"), [relationship.company.recruiterName, relationship.company.recruiterEmail].filter(Boolean).join(" · "))}
{renderCompanyMeta(t("companiesLastContacted"), formatStoredCalendarDay(relationship.company.lastContactedAt, language === "nb" ? "nb-NO" : "en") || null)}
{renderCompanyMeta(t("companiesNextContact"), formatStoredCalendarDay(relationship.company.nextContactAt, language === "nb" ? "nb-NO" : "en") || null)}
{renderCompanyMeta(t("companiesLastContacted"), relationship.company.lastContactedAt ? new Date(relationship.company.lastContactedAt).toLocaleDateString(language === "nb" ? "nb-NO" : "en") : null)}
{renderCompanyMeta(t("companiesNextContact"), relationship.company.nextContactAt ? new Date(relationship.company.nextContactAt).toLocaleDateString(language === "nb" ? "nb-NO" : "en") : null)}
</Box>
<Box>
<Typography component="h3" variant="sectionTitle" sx={{ mb: 1 }}>{t("companiesApplications")}</Typography>
@@ -19,7 +19,6 @@ import { DatePicker } from "@mui/x-date-pickers/DatePicker";
import { format, parseISO } from "date-fns";
import { api } from "../api";
import { saveCalendarDay, storedCalendarDay } from "../calendarDay";
import { Company, JobApplication } from "../types";
import { useToast } from "../toast";
import { useCompanies } from "../hooks/useCompanies";
@@ -75,7 +74,6 @@ export default function EditJobDialog({ open, jobId, onClose, onSaved }: Props)
const [version, setVersion] = useState<number | null>(null);
const session = useRef(0);
const saving = useRef(false);
const originalDates = useRef<Pick<JobApplication, "dateApplied" | "deadline"> | null>(null);
const { companies } = useCompanies();
const [company, setCompany] = useState<Company | null>(null);
@@ -116,14 +114,13 @@ export default function EditJobDialog({ open, jobId, onClose, onSaved }: Props)
api.get<JobApplication>(`/jobapplications/${jobId}`).then((r) => {
if (current !== session.current) return;
const j = r.data;
originalDates.current = { dateApplied: j.dateApplied, deadline: j.deadline };
setVersion(j.version);
setCompany(j.company ?? null);
setJobTitle(j.jobTitle ?? "");
setStatus(j.status ?? "Applied");
setInitialStatus(j.status ?? "Applied");
setStatusChangedAt(new Date().toISOString().slice(0, 10));
setDateApplied(storedCalendarDay(j.dateApplied));
setDateApplied(toDateInputValue(j.dateApplied ?? undefined));
setLocation(j.location ?? "");
setSalary(j.salary ?? "");
setSalaryMin(j.salaryMin != null ? String(j.salaryMin) : "");
@@ -138,7 +135,7 @@ export default function EditJobDialog({ open, jobId, onClose, onSaved }: Props)
setTranslatedDescription((j as any).translatedDescription ?? "");
setDescriptionLanguage((j as any).descriptionLanguage ?? "");
setTags(parseTags((j as any).tags));
setDeadline(storedCalendarDay(j.deadline));
setDeadline((j as any).deadline ? toDateInputValue((j as any).deadline) : "");
setCoverLetterText(j.coverLetterText ?? "");
setResponseReceived(Boolean(j.responseReceived));
setResponseDate(j.responseDate ? toDateInputValue(j.responseDate) : "");
@@ -183,9 +180,9 @@ export default function EditJobDialog({ open, jobId, onClose, onSaved }: Props)
translatedDescription: translatedDescription || null,
descriptionLanguage: descriptionLanguage || null,
tags: tags.length ? JSON.stringify(tags) : null,
deadline: saveCalendarDay(deadline, originalDates.current?.deadline),
deadline: deadline || null,
coverLetterText: coverLetterText || null,
dateApplied: saveCalendarDay(dateApplied, originalDates.current?.dateApplied),
dateApplied: dateApplied || null,
jobUrl: jobUrl.trim() || null,
});
if (current !== session.current) return;
+2 -3
View File
@@ -38,7 +38,6 @@ import SearchIcon from "@mui/icons-material/Search";
import WorkOutlineIcon from "@mui/icons-material/WorkOutline";
import { api } from "../api";
import { formatStoredCalendarDay } from "../calendarDay";
import ViewStateNotice from "./ViewStateNotice";
import { useCompanies } from "../hooks/useCompanies";
import { useDebouncedValue } from "../hooks/useDebouncedValue";
@@ -489,7 +488,7 @@ export default function JobTable({ refreshToken, pageSize, onPageSizeChange, col
toneName: statusTone(job.status),
tags: parseTags(job.tags),
actionSignals: actionSignal ? [actionSignal] : [],
appliedDateLabel: formatStoredCalendarDay(job.dateApplied, language === "nb" ? "nb-NO" : "en") || "—",
appliedDateLabel: job.dateApplied ? new Date(job.dateApplied).toLocaleDateString(language === "nb" ? "nb-NO" : "en") : "—",
isSelected: selectedIdSet.has(job.id),
};
}), [buildWorkflowActionSignal, filteredJobs, selectedIdSet, language]);
@@ -916,7 +915,7 @@ export default function JobTable({ refreshToken, pageSize, onPageSizeChange, col
{columns.status ? <TableCell><Chip label={statusLabel(t, job.status)} size="small" color={toneName as any} variant="outlined" sx={{ fontWeight: 600 }} /></TableCell> : null}
{columns.dateApplied ? <TableCell>{appliedDateLabel}</TableCell> : null}
{columns.daysSince ? <TableCell>{job.daysSince ?? "—"}</TableCell> : null}
<TableCell>{formatStoredCalendarDay(job.deadline, language === "nb" ? "nb-NO" : "en") || "—"}</TableCell>
<TableCell>{job.deadline ? new Date(job.deadline).toLocaleDateString(language === "nb" ? "nb-NO" : "en") : "—"}</TableCell>
{columns.jobUrl ? <TableCell>{job.jobUrl ? <Link href={job.jobUrl} target="_blank" rel="noreferrer" underline="always">{t("jobTableLink")}</Link> : ""}</TableCell> : null}
<TableCell align="right">{rowActions(job)}</TableCell>
</TableRow>
@@ -108,19 +108,10 @@ test.each(["en", "nb"] as const)("%s Edit date-only picker round trip preserves
await waitFor(() => expect(client.put).toHaveBeenCalledWith("/jobapplications/1", expect.objectContaining({ expectedVersion: 7, dateApplied: "2026-11-23", deadline: "2026-11-23", followUpAt: "2026-11-23", responseDate: "2026-11-23" })));
});
test.each([
"2026-11-23",
"2026-11-23T23:30:00Z",
"2026-11-23T23:30:00-08:00",
"2026-11-23T00:00:00",
])("Edit displays the stored day and submits the original value when unchanged (%s)", async original => {
client.get.mockResolvedValue({ data: { ...job, dateApplied: original, deadline: original } } as any);
test("Edit retains its existing UTC calendar-day loading policy for a legacy offset timestamp", async () => {
client.get.mockResolvedValue({ data: { ...job, deadline: "2026-11-23T23:30:00-08:00" } } as any);
render(wrap(<EditJobDialog open jobId={1} onClose={jest.fn()} onSaved={jest.fn()} />));
await screen.findByDisplayValue("Teacher");
expect(screen.getByLabelText(translations.en.editJobAppliedOn)).toHaveTextContent("2026-11-23");
expect(screen.getByLabelText(translations.en.editJobDeadline)).toHaveTextContent("2026-11-23");
fireEvent.click(screen.getByRole("button", { name: translations.en.save }));
await waitFor(() => expect(client.put).toHaveBeenCalledWith("/jobapplications/1", expect.objectContaining({
expectedVersion: 7, dateApplied: original, deadline: original,
})));
expect(screen.getByLabelText(translations.en.editJobDeadline)).toHaveTextContent("2026-11-24");
expect(client.put).not.toHaveBeenCalled();
});
@@ -216,8 +216,8 @@ test("Bokmål display localizes standard statuses without changing API values or
const row = await screen.findByRole("row", { name: /platform engineer/i });
expect(lastParams().status).toBe("Custom review");
expect(within(row).getByText(translations.nb.statusInterview)).toBeVisible();
expect(within(row).getByText(new Date(standardJob.dateApplied).toLocaleDateString("nb-NO", { timeZone: "UTC" }))).toBeVisible();
expect(within(row).getByText(new Date(standardJob.deadline).toLocaleDateString("nb-NO", { timeZone: "UTC" }))).toBeVisible();
expect(within(row).getByText(new Date(standardJob.dateApplied).toLocaleDateString("nb-NO"))).toBeVisible();
expect(within(row).getByText(new Date(standardJob.deadline).toLocaleDateString("nb-NO"))).toBeVisible();
expect(screen.getByRole("combobox", { name: translations.nb.jobTableStatus })).toHaveTextContent("Custom review");
fireEvent.click(within(row).getByRole("button", { name: `${translations.nb.jobTableActions}: ${job.jobTitle}` }));
fireEvent.click(await screen.findByRole("menuitem", { name: translations.nb.jobTableSetStatus.replace("{status}", translations.nb.statusOffer) }));