fix: nest legacy bills and stamp builds with commit
This commit is contained in:
1 parent
85a21c58eb
commit
f02c452d6c
17 files changed
+214
-27
No files matched your search
@@ -6,7 +6,7 @@ import { act } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { MemoryRouter } from "react-router";
|
||||
import { createSeedDataset } from "../../domain/seed.ts";
|
||||
import { addBudgetFolder, addRecurringCost, confirmOccurrence } from "../../store/actions.ts";
|
||||
import { addBudgetFolder, addRecurringCost, confirmOccurrence, placeRecurringUnderPost } from "../../store/actions.ts";
|
||||
import { monthView } from "../../domain/views.ts";
|
||||
import { store } from "../../store/index.ts";
|
||||
import { PostTableLegend } from "./PostTable.tsx";
|
||||
@@ -57,3 +57,27 @@ test("legend scopes base currency to post figures and identifies bill currencies
|
||||
expect(legend.textContent).toContain("Projected subtracts bills not yet confirmed.");
|
||||
expect(legend.textContent).not.toContain("All figures");
|
||||
}));
|
||||
|
||||
test("bills beneath a post are hidden until its post is expanded", () => {
|
||||
const data = createSeedDataset("2026-09");
|
||||
const games = data.posts[0]!;
|
||||
const bill = addRecurringCost(data, { name: "Star Rail Pass", folderId: null, archived: false, amount: { amount: 35, currency: "DKK" }, startDate: "2026-09", recurrence: { kind: "everyNMonths", n: 1 }, anchoring: "calendar", splitMode: "percent", splits: [{ postId: games.id, value: 100, absorbsRemainder: true }] });
|
||||
placeRecurringUnderPost(data, bill.id, games.id);
|
||||
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>));
|
||||
const controls = Array.from(container.querySelectorAll(`button[aria-label="Bills under ${games.name}"]`)) as HTMLButtonElement[];
|
||||
expect(controls).toHaveLength(2);
|
||||
expect(controls[0]!.getAttribute("aria-expanded")).toBe("false");
|
||||
expect(container.querySelector(`[data-budget-item="${bill.id}"]`)).toBeNull();
|
||||
act(() => controls[0]!.click());
|
||||
expect(controls[0]!.getAttribute("aria-expanded")).toBe("true");
|
||||
expect(container.querySelectorAll(`[data-budget-item="${bill.id}"]`)).toHaveLength(2);
|
||||
} finally {
|
||||
act(() => root.unmount()); container.remove(); Object.assign(store, original);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user