fix: keep compact trend icons aligned beside room values

This commit is contained in:
jhartworks committed 2026-11-11 12:15:37 +01:00
1 parent cfc77787a0
commit 2bf5f4a60a
10 files changed
+238 -157

No files matched your search

+20
View File
@@ -219,6 +219,25 @@ try {
});
await page.waitForFunction(() => window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate").length === 2);
const text = () => page.evaluate(() => window.climateView.shadowRoot.querySelector(`.live-card[data-room="${window.climateRoomId}"]`).textContent);
await page.evaluate(() => {
window.assertClimateLayout = () => {
for (const card of window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")) {
const rows = [...card.querySelectorAll(".live-row")], bounds = rows.map((r) => r.getBoundingClientRect());
const values = rows.map((r) => r.querySelector("b").getBoundingClientRect());
if (Math.max(...values.map((r) => r.right)) - Math.min(...values.map((r) => r.right)) > .5) throw new Error("Logged and unlogged values must share the same right edge");
if (Math.max(...bounds.map((r) => r.height)) > 18.5 || Math.max(...bounds.map((r) => r.height)) - Math.min(...bounds.map((r) => r.height)) > .5) throw new Error("A trend icon must not increase a climate row's height");
for (const row of rows) {
const value = row.querySelector("b").getBoundingClientRect(), metric = row.querySelector("span").getBoundingClientRect();
if (metric.right > value.left) throw new Error("The metric symbol must not overlap its value");
const trend = row.querySelector("nf-trend-button");
if (!trend) continue;
const button = trend.shadowRoot.querySelector("button").getBoundingClientRect(), glyph = trend.shadowRoot.querySelector("svg").getBoundingClientRect();
if (button.width > 18.5 || button.height > 18.5 || glyph.width > 12.5 || value.right > button.left) throw new Error("The compact trend symbol must occupy its own column");
}
}
};
});
await page.evaluate(async () => { for (const b of window.climateView.shadowRoot.querySelectorAll("nf-trend-button")) await b.updateComplete; window.assertClimateLayout(); });
assert.match(await text(), /21,5\s*°C/);
assert.match(await text(), /52\s*%/);
assert.match(await text(), /780\s*ppm/);
@@ -322,6 +341,7 @@ try {
await page.setViewport({ width: 390, height: 844 });
await page.evaluate(() => { window.nfPanel.narrow = true; });
await page.waitForFunction(() => [...window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate")].every((c) => { const r = c.getBoundingClientRect(); return r.left >= 0 && r.right <= innerWidth; }));
await page.evaluate(() => window.assertClimateLayout());
await page.screenshot({ path: join(out, "symcon-climate-mobile.png") });
await page.evaluate(() => { const p = window.nfPanel; p._floorId = window.climateFloorId; p._roomId = window.climateRoomId; });
await page.waitForFunction(() => window.climateView.panelOpen && window.climateView.shadowRoot.querySelectorAll(".live-card-roomclimate").length === 1);