Split speed graph and value into separate modules

Render the 150-pixel sparkline and fixed-width speed label as independent bordered pills so changing digit counts cannot move or resize the graph.
This commit is contained in:
Sucukdeluxe
2026-08-26 15:24:59 +02:00
parent 2bd20b12b4
commit 98c688fc4c
3 changed files with 30 additions and 10 deletions
+3
View File
@@ -595,9 +595,12 @@ describe("bandwidth chart palette", () => {
it("uses the spare zero-speed label space for a longer sparkline", () => {
const css = readFileSync(new URL("../src/renderer/styles.css", import.meta.url), "utf8");
const source = readFileSync(new URL("../src/renderer/App.tsx", import.meta.url), "utf8");
expect(css).toMatch(/\.speed-sparkline-canvas\s*\{[^}]*width:\s*150px;/s);
expect(css).toMatch(/\.speed-sparkline-value\s*\{[^}]*flex:\s*0 0 12ch;[^}]*width:\s*12ch;[^}]*min-width:\s*12ch;/s);
expect(source).toContain('className="speed-sparkline-graph"');
expect(css).toMatch(/\.speed-sparkline-graph,\s*\.speed-sparkline-value\s*\{[^}]*background:\s*var\(--field\);[^}]*border:\s*1px solid var\(--border\);[^}]*border-radius:\s*8px;/s);
});
it("aligns the idle speed line to one physical pixel at every display scale", () => {