fix: render in-flight count as static white (remove blink pulse)

This commit is contained in:
2026-08-14 12:09:57 -06:00
parent 07fea457f1
commit ca37a690ca
3 changed files with 15 additions and 37 deletions
+13 -14
View File
@@ -8,14 +8,14 @@ test("svgDataUrl wraps an SVG as a base64 data URL", () => {
});
test("renderInflight: ready + count renders IDLE in green", () => {
const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 0, offline: false, pulse: false });
const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 0, offline: false });
assert.match(svg, /IDLE/);
assert.match(svg, /#1e6b34/);
assert.doesNotMatch(svg, /ACTIVE/);
});
test("renderInflight: ready + count>0 renders the count number on red", () => {
const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 2, offline: false, pulse: false });
const svg = renderInflight({ modelName: "Qwen3.8-27B-NVFP4", state: "ready", count: 2, offline: false });
assert.match(svg, /2/);
assert.match(svg, /#8b2626/);
assert.doesNotMatch(svg, /ACTIVE/);
@@ -23,40 +23,39 @@ test("renderInflight: ready + count>0 renders the count number on red", () => {
});
test("renderInflight: idle state does not show a count number", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 0, offline: false, pulse: false });
const svg = renderInflight({ modelName: "A", state: "ready", count: 0, offline: false });
assert.match(svg, /IDLE/);
assert.doesNotMatch(svg, /font-size="24"/);
});
test("renderInflight: draws a count-trend spark when history has 2+ samples", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false, history: [0, 1, 2, 1] });
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, history: [0, 1, 2, 1] });
assert.match(svg, /<polyline/);
assert.match(svg, /<path/);
});
test("renderInflight: no spark with fewer than 2 history samples", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false, history: [1] });
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, history: [1] });
assert.doesNotMatch(svg, /<polyline/);
const none = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false });
const none = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false });
assert.doesNotMatch(none, /<polyline/);
});
test("renderInflight: pulse toggles opacity while active", () => {
const a = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: false });
const b = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false, pulse: true });
assert.notEqual(a, b);
assert.match(b, /opacity="0.55"/);
test("renderInflight: active count is static white (no blink opacity)", () => {
const svg = renderInflight({ modelName: "A", state: "ready", count: 1, offline: false });
assert.match(svg, />1</);
assert.doesNotMatch(svg, /opacity="0.55"/);
});
test("renderInflight: offline and no-model states", () => {
const offline = renderInflight({ modelName: "A", state: "ready", count: 0, offline: true, pulse: false });
const offline = renderInflight({ modelName: "A", state: "ready", count: 0, offline: true });
assert.match(offline, /OFFLINE/);
const noModel = renderInflight({ modelName: "unset", state: undefined, count: 0, offline: false, pulse: false });
const noModel = renderInflight({ modelName: "unset", state: undefined, count: 0, offline: false });
assert.match(noModel, /NO MODEL/);
});
test("renderInflight: loading renders LOADING in amber", () => {
const svg = renderInflight({ modelName: "A", state: "loading", count: 0, offline: false, pulse: false });
const svg = renderInflight({ modelName: "A", state: "loading", count: 0, offline: false });
assert.match(svg, /LOADING/);
assert.match(svg, /#8a6d1d/);
});