From 228d48d97836507d23e9952530b6333ef59e45fb Mon Sep 17 00:00:00 2001 From: Lucas Winther Date: Wed, 30 Sep 2026 00:54:15 +0200 Subject: [PATCH] fix: clarify currencies in mixed budget legend --- src/ui/components/BudgetTree.test.tsx | 11 ++++++++++- src/ui/components/PostTable.tsx | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/ui/components/BudgetTree.test.tsx b/src/ui/components/BudgetTree.test.tsx index df54080..c98681d 100644 --- a/src/ui/components/BudgetTree.test.tsx +++ b/src/ui/components/BudgetTree.test.tsx @@ -9,6 +9,7 @@ import { createSeedDataset } from "../../domain/seed.ts"; import { addBudgetFolder, addRecurringCost, confirmOccurrence } from "../../store/actions.ts"; import { monthView } from "../../domain/views.ts"; import { store } from "../../store/index.ts"; +import { PostTableLegend } from "./PostTable.tsx"; import { BudgetTree } from "./BudgetTree.tsx"; function setup(run: (container: HTMLDivElement, billId: string) => void, confirm = false) { @@ -21,7 +22,7 @@ function setup(run: (container: HTMLDivElement, billId: string) => void, confirm if (confirm) confirmOccurrence(data, bill.id, "2026-09", { date: "2026-09-01" }); const original = { get: store.get, subscribe: store.subscribe }; store.get = () => data; store.subscribe = () => () => {}; const container = document.createElement("div"); document.body.append(container); const root = createRoot(container); - try { act(() => root.render()); run(container, bill.id); } + try { act(() => root.render()); run(container, bill.id); } finally { act(() => root.unmount()); container.remove(); Object.assign(store, original); } } function housing(container: HTMLDivElement) { return container.querySelector('button[aria-label="Housing"]') as HTMLButtonElement; } @@ -48,3 +49,11 @@ test("bill edit reaches its settings row", () => setup((container, billId) => { expect(container.textContent).toContain("Ended"); expect(container.textContent).toContain("Next 2028-03"); }, true)); + +test("legend scopes base currency to post figures and identifies bill currencies", () => setup(container => { + const legend = container.querySelector("span.flex.flex-wrap")!; + expect(legend.textContent).toContain("Post figures in DKK."); + expect(legend.textContent).toContain("Bill prices show their own currency."); + expect(legend.textContent).toContain("Projected subtracts bills not yet confirmed."); + expect(legend.textContent).not.toContain("All figures"); +})); diff --git a/src/ui/components/PostTable.tsx b/src/ui/components/PostTable.tsx index 43a5ece..34d5477 100644 --- a/src/ui/components/PostTable.tsx +++ b/src/ui/components/PostTable.tsx @@ -76,7 +76,7 @@ export function PostTableLegend({ baseCurrency }: { baseCurrency: Currency }) { return ( - All figures in {baseCurrency}. Projected subtracts bills not yet confirmed. + Post figures in {baseCurrency}. Bill prices show their own currency. Projected subtracts bills not yet confirmed.