panel: Allowance shows what's left; Remaining becomes Dues

The Members table's Allowance column printed the uniform $15 balance, which
is the total, not what the member still has. It now computes
max(balance - spend, 0) client-side from the two served fields (no series
summed in the browser), keeps its allowance-only class so it still hides in
All-time mode, and reads "Allowance left" with a title saying it is a budget,
not OC dues.

The Remaining column (allowance + credits - spend, a credit figure) is
replaced by Dues: the member's current Open Collective contribution level,
rendered $10/mo / $120/yr and '—' when the portal has no readable level.
Dues sorts by dues_amount with unknowns last, and carries no balance-col, so
it stays visible in both modes.

tests/check-page-js.sh now stubs classList/parentElement so a harness can
observe the mode toggle; admin-panel-dues-harness.js pins the subtraction,
floor, dues text, null handling, sort and 10-cell column count in both modes;
tests/test_member_table_columns.py pins the header/row alignment.
This commit is contained in:
inference-bot committed 2026-11-17 09:02:25 +00:00
1 parent 3c3fb0b921
commit 2ae9868966
4 files changed
+264 -7

No files matched your search

+11
View File
@@ -83,6 +83,10 @@ const mkEl = (id) => {
const el = {
id, style: {}, textContent: "", innerHTML: "", className: "",
offsetWidth: 120, offsetHeight: 48,
// classList/parentElement, because the tables toggle their mode class on
// the table's PARENT (members-all-time / admins-all-time) and a harness
// must be able to observe that toggle rather than crash on it.
classList: null, parentElement: null, __classes: {},
// Stateful attributes, like a real element: a stub that always answers null
// cannot tell "wired once" from "wired on every call".
getAttribute: (k) => (k in attrs ? attrs[k] : null),
@@ -98,6 +102,13 @@ const mkEl = (id) => {
// (buildMetricButtons inserts the SHARED metric list), so the stub has to
// support it or the harness cannot exercise that path at all.
el.insertAdjacentHTML = (pos, html) => { el.innerHTML += html; };
el.classList = {
toggle: (c, on) => { el.__classes[c] = (on === undefined ? !el.__classes[c] : !!on); },
add: (c) => { el.__classes[c] = true; },
remove: (c) => { el.__classes[c] = false; },
contains: (c) => !!el.__classes[c],
};
el.parentElement = { classList: el.classList };
return el;
};
globalThis.document = {