113 files

This commit is contained in:
Home Assistant Version Control committed 2026-08-26 07:17:31 +00:00
1 parent 0533eaca8d
commit 15c0e35c18
113 files changed
+12448 -1673

No files matched your search

@@ -48,8 +48,13 @@ describe("budget KPI tiles: spent-only display (#104)", () => {
const tiles = sr(el).querySelectorAll(".budget-tile");
expect(tiles.length).to.equal(2);
expect(sr(el).querySelectorAll(".budget-tile-bar").length).to.equal(1);
expect(tiles[0].textContent).to.contain("9.00 / 150 €");
// 2026-08-24: the spent amount carries the full stat-value typography
// (same size as the other KPI chips); the "/ max" ratio is its own
// small line so it can't overflow the grid cell.
expect(tiles[0].querySelector(".stat-value")!.textContent).to.contain("9.00 €");
expect(tiles[0].querySelector(".budget-tile-max")!.textContent).to.contain("/ 150 €");
expect(tiles[1].textContent).to.contain("429.60 €");
expect(tiles[1].querySelector(".budget-tile-max"), "spent-only tile has no ratio line").to.equal(null);
});
it("tiles live INSIDE the stats strip (#125)", async () => {
@@ -99,6 +99,25 @@ describe("trigger-chart", () => {
const marks = el.shadowRoot!.querySelectorAll('rect[fill="var(--success-color, #4caf50)"]');
expect(marks.length).to.equal(1);
});
it("renders the production-shaped projection with real horizontal extent", async () => {
// sparkline.ts builds the projection as [last sample, last sample + 30d].
// Before the domain fix (2026-08-24) the data-only time domain put that
// start on the right plot edge and the x2 clamp collapsed the dashed
// line to zero width — the degradation projection never rendered.
const el = await mount();
const last = POINTS[POINTS.length - 1];
el.projection = [last, { ts: last.ts + 30 * DAY, val: last.val + 15 }];
await el.updateComplete;
const line = el.shadowRoot!.querySelector('line[stroke-dasharray="4,3"]');
expect(line, "projection line rendered").to.exist;
const x1 = Number(line!.getAttribute("x1"));
const x2 = Number(line!.getAttribute("x2"));
expect(x2 - x1, `projection width (${x1} -> ${x2})`).to.be.greaterThan(50);
// still clamped inside the plot
const svgW = Number(el.shadowRoot!.querySelector("svg")!.getAttribute("width"));
expect(x2).to.be.at.most(svgW);
});
});
describe("chart-utils", () => {