various edits

This commit is contained in:
2026-07-21 16:43:22 -06:00
parent 88161a6f16
commit c1e453d962
16 changed files with 526 additions and 31 deletions
+47
View File
@@ -12,6 +12,7 @@ import {
loadDashboardData,
validateAssetSet,
} from "../js/data.js";
import { renderUtahCoverage } from "../js/charts.js";
const DASHBOARD_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const PUBLIC_DATA = path.join(DASHBOARD_ROOT, "public", "data");
@@ -84,13 +85,41 @@ test("narrow layouts constrain body content while preserving local nav scrolling
assert.match(css, /html\s*{[^}]*max-width:\s*100%;[^}]*overflow-x:\s*clip;/s);
assert.match(css, /body\s*{[^}]*max-width:\s*100%;[^}]*overflow-x:\s*clip;/s);
assert.match(css, /\.primary-nav__inner\s*{[^}]*overflow-x:\s*auto;/s);
assert.match(css, /\.explorer-results\s*{[^}]*min-width:\s*0;/s);
const mobile = css.match(/@media \(max-width: 660px\)\s*{[\s\S]*?(?=@media|$)/)?.[0];
assert.ok(mobile, "mobile breakpoint is present");
assert.match(mobile, /\.page-shell\s*{[^}]*width:\s*auto;[^}]*max-width:\s*calc\(100% - 2rem\);/s);
assert.match(mobile, /\.preview-banner\s*{[^}]*justify-content:\s*flex-start;/s);
assert.match(mobile, /\.chart--scorecard\s*{[^}]*overflow-x:\s*auto;/s);
assert.match(mobile, /\.chart--scorecard svg\s*{[^}]*min-width:\s*720px;/s);
assert.match(mobile, /overflow-wrap:\s*anywhere;/);
});
test("county coverage renders Utah's northeast step and geographically aligned feeds", () => {
const attributes = new Map();
const container = {
innerHTML: "",
setAttribute(name, value) {
attributes.set(name, value);
},
};
renderUtahCoverage(container, ["weber", "salt_lake", "utah"]);
assert.match(
container.innerHTML,
/data-map-feature="utah-outline" d="M44 20H153V67H226V255H44Z"/,
);
assert.doesNotMatch(container.innerHTML, /stroke-dasharray/);
assert.equal(container.innerHTML.match(/<circle\b/g)?.length, 3);
assert.match(container.innerHTML, /cx="123" cy="54"[^>]*><title>Weber County/);
assert.match(container.innerHTML, /cx="121" cy="83"[^>]*><title>Salt Lake County/);
assert.match(container.innerHTML, /cx="131" cy="108"[^>]*><title>Utah County/);
assert.match(container.innerHTML, />UTAH<\/text>/);
assert.match(attributes.get("aria-label"), /^Outline of Utah showing/);
assert.doesNotMatch(attributes.get("aria-label"), /_/);
});
test("model view declares the final model, benchmark role, and publication boundary", () => {
const html = readFileSync(path.join(DASHBOARD_ROOT, "index.html"), "utf8");
const modelView = viewSource(html, "model");
@@ -120,6 +149,16 @@ test("every result-facing view visibly labels the sample and non-population scop
assert.match(html, /not a reliability ranking or population comparison/i);
});
test("cohort view discloses which rows are combined families", () => {
const html = readFileSync(path.join(DASHBOARD_ROOT, "index.html"), "utf8");
const cohortView = viewSource(html, "cohorts");
assert.match(cohortView, /Combined model families:/);
assert.match(cohortView, /Silverado 1500; Dodge Ram 1500; Hyundai Elantra; Nissan Altima; Subaru Outback;/);
assert.match(cohortView, /Toyota 4Runner, Corolla, and Tacoma/);
assert.match(cohortView, /Exact source-label cohorts:/);
assert.match(cohortView, /Ford F150; Honda Accord and Civic; and Toyota Camry/);
});
test("all required generated assets satisfy the browser contract", () => {
const validated = validateAssetSet(assetSet());
assert.equal(validated.manifest.schema_version, SCHEMA_VERSION);
@@ -139,6 +178,14 @@ test("all required generated assets satisfy the browser contract", () => {
["train", "tune", "calibrate"],
);
assert.ok(validated.overview.rows.length > 0);
assert.equal(validated.scorecards.rows.length, 12);
assert.deepEqual(
validated.filters.prior_make_models,
validated.scorecards.rows.map(({ prior_make, prior_model }) => ({
prior_make,
prior_model,
})),
);
});
test("browser loader verifies every raw asset digest before rendering", async () => {