147
147
assert.equal(desktop.yHumid.display, true);
148
148
assert.equal(desktop.yRain.display, true);
149
149
});
150
+
Added:
151
+
Added:
test("compact single-axis insights scales drop the axis title", async () => {
152
+
Added:
const module = await dashboardModule("insights.js");
153
+
Added:
const { insightsSingleAxisScales } = module.namespace;
154
+
Added:
155
+
Added:
const compact = insightsSingleAxisScales(true, {
156
+
Added:
title: "Volatility (σ)",
157
+
Added:
y: { beginAtZero: true }
158
+
Added:
});
159
+
Added:
const desktop = insightsSingleAxisScales(false, { title: "Volatility (σ)" });
160
+
Added:
161
+
Added:
assert.equal(compact.y.title.display, false);
162
+
Added:
assert.equal(compact.x.ticks.maxRotation, 0);
163
+
Added:
assert.equal(compact.x.ticks.maxTicksLimit, 6);
164
+
Added:
// Extra y options are preserved through the merge.
165
+
Added:
assert.equal(compact.y.beginAtZero, true);
166
+
Added:
167
+
Added:
assert.equal(desktop.y.title.display, true);
168
+
Added:
assert.equal(desktop.y.title.text, "Volatility (σ)");
169
+
Added:
assert.equal(desktop.x.ticks.maxRotation, 45);
170
+
Added:
});
171
+
Added:
172
+
Added:
test("compact overlay insights scales collapse secondary axes", async () => {
173
+
Added:
const module = await dashboardModule("insights.js");
174
+
Added:
const { insightsOverlayScales } = module.namespace;
175
+
Added:
176
+
Added:
const primary = { id: "yDO", text: "DO (mg/L)", color: "#0ea5e9" };
177
+
Added:
const secondaries = [
178
+
Added:
{ id: "yORP", text: "ORP (mV)", color: "#f59e0b" },
179
+
Added:
{ id: "yTemp", text: "°C", color: "#64748b" }
180
+
Added:
];
181
+
Added:
182
+
Added:
const compact = insightsOverlayScales(true, primary, secondaries);
183
+
Added:
const desktop = insightsOverlayScales(false, primary, secondaries);
184
+
Added:
185
+
Added:
// Primary axis stays visible but loses its title on phones.
186
+
Added:
assert.equal(compact.yDO.title.display, false);
187
+
Added:
assert.equal(compact.yDO.position, "left");
188
+
Added:
assert.equal(compact.yDO.ticks.color, "#0ea5e9");
189
+
Added:
190
+
Added:
// Secondary right-hand axes are hidden entirely to reclaim width.
191
+
Added:
assert.equal(compact.yORP.display, false);
192
+
Added:
assert.equal(compact.yTemp.display, false);
193
+
Added:
194
+
Added:
// Desktop keeps everything.
195
+
Added:
assert.equal(desktop.yDO.title.display, true);
196
+
Added:
assert.equal(desktop.yORP.display, true);
197
+
Added:
assert.equal(desktop.yTemp.display, true);
198
+
Added:
assert.equal(desktop.yTemp.title.text, "°C");
199
+
Added:
});
200
+
Added:
201
+
Added:
test("compact viewport helper degrades gracefully without matchMedia", async () => {
202
+
Added:
const module = await dashboardModule("viewport.js");
203
+
Added:
const { isCompactViewport, COMPACT_MEDIA_QUERY } = module.namespace;
204
+
Added:
205
+
Added:
assert.equal(COMPACT_MEDIA_QUERY, "(max-width: 575.98px)");
206
+
Added:
// No window in the test VM → must not throw, returns false.
207
+
Added:
assert.equal(isCompactViewport(), false);
208
+
Added:
});