Show "shown of total" in control board project headers while rows are hidden (#1503)
A project header now reads "fleet (13 of 38)" while Hide offline or Hide seen hides at least one row, and "fleet (38)" when nothing is hidden. The note under the table still says which filter hid how many. Numbers only, so nothing new needs escaping. Static test pins the expression and the removal of the raw-length header. Sonnet review: APPROVED, no findings. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
@@ -558,3 +558,17 @@ test("page.html: each project has a Hide seen checkbox (default on) beside Hide
|
||||
assert.match(body, /" seen hidden"/, "the note reports how many seen rows are hidden");
|
||||
assert.match(html, /closest\("\.hide-offline-toggle, \.hide-seen-toggle"\)/, "one change handler serves both checkboxes");
|
||||
});
|
||||
|
||||
test("page.html: a project header reads \"N of N\" only while a checkbox hides rows", () => {
|
||||
const html = readFileSync(join(pkgRoot, "src", "page.html"), "utf8");
|
||||
const m = html.match(/function renderProjects\(data\) \{[\s\S]*?\n \}/);
|
||||
assert.ok(m, "renderProjects() must exist in page.html");
|
||||
const body = m[0];
|
||||
assert.match(
|
||||
body,
|
||||
/var headCount = visible\.length < group\.length \? visible\.length \+ " of " \+ group\.length : String\(group\.length\)/,
|
||||
"shown-of-total only when something is hidden; the plain total otherwise",
|
||||
);
|
||||
assert.match(body, /<span>\(' \+ headCount \+ "\)<\/span>/, "the header uses headCount, not the raw group length");
|
||||
assert.doesNotMatch(body, /<span>\(' \+ group\.length/, "the raw group length must no longer be rendered in the header");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user