Merge main (e4708a81, #1745) into the renderer branch

Main brings the reviewed one-time-control and timeline-mark changes. They
keep this branch's renderer work: earthquakes draw through the draw port and
register their strong quakes as marks; the weather clock keeps `follows` beside
`world`; the weather layer measures ages and delays from the timeline time;
the Visual panel keeps its sky and weather groups under Effects. Tests that
moved time through the weather clock now move it on the world clock.
This commit is contained in:
Sameh Khamis committed 2026-11-14 22:08:39 -08:00
commit 0ecbfbecd0
123 files changed
+5917 -1471

No files matched your search

+48 -42
View File
@@ -55,10 +55,6 @@ function fixture() {
listeners.add(fn);
return () => listeners.delete(fn);
},
setTarget: (tick) => calls.push(['target', tick]),
latest: () => calls.push(['latest']),
togglePlay: () => calls.push(['play']),
step: (n) => calls.push(['step', n]),
};
return {
...f,
@@ -75,39 +71,55 @@ function fixture() {
},
};
}
const timelineHost = (f) =>
f.find((n) => n.className === 'weather-timeline-block');
const frameTime = (f) => f.find((n) => n.className === 'weather-frame-time');
const card = (f, id) => f.find((n) => n.dataset.cardId === id);
const line = (f, id, name) =>
f.find((n) => n.dataset.lineId === name, card(f, id));
test('timeline stays visible with any observed product; native preview and transport use the clock', (t) => {
t.mock.timers.enable({ apis: ['setTimeout'] });
test('the frame time shows with any observed product; the panel has no time controls of its own', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: Date.parse('2026-09-22T01:17:00Z'),
});
const f = fixture();
const view = createWeatherPanel(f);
view.update([wind]);
assert.equal(timelineHost(f).hidden, true);
assert.equal(frameTime(f).hidden, true);
view.update([wind, radar]);
assert.equal(timelineHost(f).hidden, false);
f.state({ timeline: [ticks[0]] });
assert.equal(timelineHost(f).hidden, false);
assert.equal(f.find((n) => n.tagName === 'INPUT').disabled, true);
f.state({ timeline: [] });
assert.equal(timelineHost(f).hidden, false);
f.state({ timeline: ticks });
assert.equal(timelineHost(f).hidden, false);
const slider = f.find((n) => n.tagName === 'INPUT');
slider.value = '0';
slider.dispatchEvent(new Event('input'));
assert.deepEqual(f.calls, []);
slider.dispatchEvent(new Event('change'));
assert.deepEqual(f.calls, [['target', ticks[0]]]);
f.find((n) => n.textContent === 'Latest' && n.tagName === 'BUTTON').click();
f.find((n) => n.textContent === 'Play').click();
assert.deepEqual(f.calls.slice(1), [['latest'], ['play']]);
slider.dispatchEvent(new Event('input'));
view.update([wind]);
t.mock.timers.tick(150);
assert.equal(f.calls.length, 3, 'hiding cancels pending drag');
assert.equal(frameTime(f).hidden, false);
assert.equal(frameTime(f).textContent, '01:05 UTC · 12 min ago');
f.state({
timeline: [ticks[0]],
products: [{ id: radar.id, shown: ticks[0], selected: ticks[0] }],
});
assert.equal(frameTime(f).textContent, '01:00 UTC · 17 min ago');
f.state({ timeline: [], products: [] });
assert.equal(frameTime(f).hidden, true);
// Suspended products (reduced motion, a hidden page) leave the timeline;
// live, their newest frame still shows.
f.state({
timeline: [],
products: [
{ id: radar.id, shown: ticks[1], selected: ticks[1], suspended: true },
{
id: 'weather-lightning',
shown: null,
selected: ticks[0],
suspended: true,
},
],
});
assert.equal(frameTime(f).hidden, false);
assert.equal(frameTime(f).textContent, '01:05 UTC · 12 min ago');
f.state({ timeline: ticks, mode: 'history', target: ticks[0] });
assert.equal(frameTime(f).textContent, '01:00 UTC');
assert.equal(
f.find((n) => n.tagName === 'INPUT'),
null,
);
assert.equal(
f.find((n) => ['Play', 'Latest'].includes(n.textContent)),
null,
);
view.destroy();
assert.equal(f.listeners.size, 0);
});
@@ -180,7 +192,7 @@ test('cyclone readout retains advisory, position, intensity, geometry, coverage,
],
};
view.update([cyclone]);
assert.equal(timelineHost(f).hidden, true);
assert.equal(frameTime(f).hidden, true);
assert.match(
line(f, cyclone.id, 'time').textContent,
/JULIO.*Hurricane.*Advisory 10.*UTC/,
@@ -411,7 +423,7 @@ test('cyclones lead, and observed history owns one bordered group with only acti
group.children[1].textContent,
'Rain radar · Satellite clouds · Lightning density',
);
assertSameNode(group.children[2], timelineHost(f));
assertSameNode(group.children[2], frameTime(f));
assert.deepEqual(
[...group.children[3].children].map((n) => n.dataset.cardId),
['weather-radar', 'weather-satellite', 'weather-lightning'],
@@ -674,13 +686,8 @@ test('history time keeps the hour whatever the length of the localized date', ()
const f = fixture();
const view = createWeatherPanel(f);
view.update([wind, radar]);
const ends = f.find((n) => n.className === 'rail-timeline-endpoints');
assert.deepEqual(
[...ends.children].map((n) => n.textContent),
['01:00 UTC', '01:05 UTC'],
locale,
);
f.state({ mode: 'history', target: ticks[1] });
assert.equal(frameTime(f).textContent, '01:05 UTC', locale);
assert.match(
line(f, radar.id, 'time').textContent,
/(^|[^\d:])01:05 UTC/,
@@ -789,7 +796,7 @@ test('source-supplied legend units are shown as given; catalog units are transla
}
});
test('at a past time, frame ages and the timeline readout count from the timeline time, not now', (t) => {
test('at a past time, frame ages count from the timeline time, not now, and the frame time is that time', (t) => {
t.mock.timers.enable({
apis: ['Date'],
now: Date.parse('2032-01-01T00:00:00Z'),
@@ -806,9 +813,8 @@ test('at a past time, frame ages and the timeline readout count from the timelin
line(f, radar.id, 'time').textContent,
'09-22 01:05 UTC · 15m ago · nearest',
);
const readout = f.find((n) => n.textContent === '01:20 UTC');
assert.ok(readout, 'the readout names the timeline time');
assert.doesNotMatch(timelineHost(f).textContent, /min ago/);
// The panel's frame time is the timeline time alone, with no age.
assert.equal(frameTime(f).textContent, '01:20 UTC');
view.destroy();
});