Skip to content

A spy satellite simulator in your browser, except the data is real. Live open source spatial intelligence on a photorealistic 3D globe.

Merge meirm/i18n-spanish: air-quality layer (AQHI), bikeshare Toronto, Panoramax count line

German Khokhlovb68f09793e66
diff --cc src/ui/weatherPanel.test.mjs
index 79f6802b5,0e0b6cd32..868f7d9ba
--- a/src/ui/weatherPanel.test.mjs
+++ b/src/ui/weatherPanel.test.mjs
@@@ -686,3 -688,68 +688,67 @@@ test('history time keeps the hour whate
}
}
});
+
-
+ test('air-quality readout renders its band legend, Canada coverage and worst-first list', async () => {
+ const observedMs = Date.now() - 10 * 60_000;
+ const reading = (stationId, value, band, name) => ({
+ id: `eccc:${stationId}`,
+ provider: 'eccc',
+ scale: 'AQHI',
+ value,
+ band,
+ stationId,
+ name,
+ zone: 'on',
+ lat: 43.65,
+ lon: -79.38,
+ observedMs,
+ color: '#4cc9f0',
+ label: String(value),
+ risk: `${band} risk`,
+ note: null,
+ });
+ const layer = createAirQualityLayer({
+ source: {
+ getSnapshot: async () => [
+ reading('B', 8, 'high', 'Hamilton'),
+ reading('A', 2, 'low', 'Toronto'),
+ ],
+ },
+ overlayHost: { setEntries() {}, setVisible() {}, clearSource() {} },
+ });
+ layer.init({ dataSources: { add() {}, remove() {} } });
+ layer.enable();
+ await layer.update();
+ const f = fixture();
+ const view = createWeatherPanel(f);
+ view.update([{ id: layer.id, icon: layer.icon, ...layer.getRowControls() }]);
+ const aq = card(f, 'air-quality');
+ assert.ok(aq, 'the air-quality card is shown');
+ assert.equal(aq.dataset.open, 'true');
+ assert.match(
+ f.find((n) => n.classList?.contains?.('rail-card-badge'), aq).textContent,
+ /Canada only/,
+ );
+ assert.match(line(f, 'air-quality', 'status').textContent, /2 stations/);
+ const entries = f.find((n) => n.className === 'rail-card-legend-entries', aq);
+ assert.equal(entries.hidden, false);
+ assert.deepEqual(
+ entries.children.map((entry) => entry.children[1].textContent),
+ ['Low', 'Moderate', 'High', 'Very High'],
+ );
+ assert.equal(
+ f.find((n) => n.className === 'rail-card-ramp', aq).hidden,
+ true,
+ );
+ const list = f.find((n) => n.dataset.blockId === 'list', aq);
+ assert.equal(list.hidden, false);
+ assert.deepEqual(
+ list.children.map((item) =>
+ item.children[0].children.map((part) => part.textContent).join(' '),
+ ),
+ ['AQHI 8 Hamilton · high risk', 'AQHI 2 Toronto · low risk'],
+ );
+ view.destroy();
+ layer.destroy();
+ });