fix: clarify currencies in mixed budget legend
This commit is contained in:
1 parent
abf57a963f
commit
228d48d978
2 files changed
+11
-2
No files matched your search
@@ -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(<MemoryRouter><BudgetTree monthId="2026-09" rows={monthView(data, "2026-09").rows} /></MemoryRouter>)); run(container, bill.id); }
|
||||
try { act(() => root.render(<MemoryRouter><PostTableLegend baseCurrency="DKK" /><BudgetTree monthId="2026-09" rows={monthView(data, "2026-09").rows} /></MemoryRouter>)); 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");
|
||||
}));
|
||||
Reference in new issue
Block a user