mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The right-rail layout pass lifts the Context, CCTV, Weather and Recent Imagery panel scrollers to measure their natural heights, which clamps their scroll offset to zero, but it only restored scrollers tagged data-rail-scroller. A layer that refreshes its Layers-panel row every second snapped the Context panel back to the top while scrolling. Tag every lifted scroller and pin the pairing with a test that reads the measuring CSS. Co-authored-by: Bilawal Sidhu <[email protected]>
31 lines
1.2 KiB
JavaScript
31 lines
1.2 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { readFileSync } from 'node:fs';
|
|
import test from 'node:test';
|
|
|
|
const read = (path) => readFileSync(new URL(path, import.meta.url), 'utf8');
|
|
|
|
// The rail's measuring pass lifts these panel scrollers to their natural
|
|
// height, which clamps their scroll offset to zero. Only scrollers tagged
|
|
// `data-rail-scroller` get their offset restored afterwards, so every lifted
|
|
// scroller must carry the tag or a layout pass snaps it back to the top.
|
|
test('every scroller the rail measuring pass lifts restores its scroll offset', () => {
|
|
const css = read('./styles/layers.css');
|
|
const templates = [
|
|
read('./templates/context.html'),
|
|
read('./templates/layer-panels.html'),
|
|
].join('\n');
|
|
const lifted = [
|
|
...css.matchAll(
|
|
/#right-context-rail\[data-rail-measuring\]\s*>\s*\[data-panel-id\]:not\(\.collapsed\)\s*>\s*\.([a-z-]+)/g,
|
|
),
|
|
].map((match) => match[1]);
|
|
assert.ok(lifted.length > 0, 'measuring CSS lists lifted scrollers');
|
|
for (const className of lifted) {
|
|
const tag = templates.match(
|
|
new RegExp(`<div class="${className}"[^>]*>`),
|
|
)?.[0];
|
|
if (!tag) continue;
|
|
assert.match(tag, /data-rail-scroller/, `${className} restores its scroll`);
|
|
}
|
|
});
|