mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
The Context header carried a Radio icon that opened a second, compact Radio player on top of the panel, duplicating the Radio section that already lives inside Context. Remove the icon, the compact player and everything that kept the two in step. Radio stays in Context as its own section with one Enable control; Cockpit's compact Radio is unchanged. Context itself was hard to read: 7-8 px labels at low contrast, a dashed placeholder box, and a glow halo. The two modes are now one segmented control, labels and guidance are 10 px at higher contrast, the standby hint is plain text, section titles use --text-secondary, and the panel draws no glow. Unused translations are pruned, tests and QA harnesses that pinned the compact player are updated or retired, and CURRENT-STATE and the changelog describe the new header.
78 lines
2.3 KiB
JavaScript
78 lines
2.3 KiB
JavaScript
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { syncRadioPanelPlacement } from './radioPanelPlacement.js';
|
|
|
|
function node() {
|
|
return {
|
|
children: [],
|
|
selectors: {},
|
|
parentElement: null,
|
|
moves: 0,
|
|
querySelector(selector) {
|
|
return this.selectors[selector] || null;
|
|
},
|
|
append(child) {
|
|
this.insertBefore(child, null);
|
|
},
|
|
insertBefore(child, before) {
|
|
if (child.parentElement) {
|
|
const siblings = child.parentElement.children;
|
|
siblings.splice(siblings.indexOf(child), 1);
|
|
}
|
|
const index = before
|
|
? this.children.indexOf(before)
|
|
: this.children.length;
|
|
this.children.splice(index, 0, child);
|
|
child.parentElement = this;
|
|
child.moves++;
|
|
},
|
|
};
|
|
}
|
|
|
|
test('all themes keep the same Radio controls nested in Context', () => {
|
|
const panel = node(),
|
|
context = node(),
|
|
rail = node(),
|
|
inner = node(),
|
|
body = node();
|
|
context.selectors['.global-context-panel-inner'] = inner;
|
|
context.selectors['.cyber-panel-body'] = body;
|
|
inner.append(panel);
|
|
const nodes = {
|
|
'radio-panel': panel,
|
|
'global-context-panel': context,
|
|
'right-context-rail': rail,
|
|
};
|
|
const doc = {
|
|
documentElement: { dataset: {} },
|
|
getElementById: (id) => nodes[id],
|
|
};
|
|
for (let cycle = 0; cycle < 3; cycle++) {
|
|
doc.documentElement.dataset.uiTheme = 'cyber';
|
|
syncRadioPanelPlacement(doc);
|
|
assert.equal(panel.parentElement, body);
|
|
const moves = panel.moves;
|
|
syncRadioPanelPlacement(doc);
|
|
assert.equal(panel.moves, moves, 'no mutation feedback loop');
|
|
delete doc.documentElement.dataset.uiTheme;
|
|
syncRadioPanelPlacement(doc);
|
|
assert.equal(panel.parentElement, body);
|
|
}
|
|
// Recover a hierarchy left by the previous Cyber implementation without
|
|
// recreating the player, changing playback, or mutating collapse state.
|
|
rail.append(panel);
|
|
doc.documentElement.dataset.uiTheme = 'cyber';
|
|
syncRadioPanelPlacement(doc);
|
|
assert.equal(panel.parentElement, body);
|
|
});
|
|
|
|
test('placement is inert before the complete shell exists', () => {
|
|
assert.doesNotThrow(() => syncRadioPanelPlacement(null));
|
|
assert.doesNotThrow(() =>
|
|
syncRadioPanelPlacement({
|
|
documentElement: { dataset: { uiTheme: 'cyber' } },
|
|
getElementById: () => null,
|
|
}),
|
|
);
|
|
});
|