Files
gods-eye-view/src/rightRailPolicy.test.mjs
T
German KhokhlovandClaude Opus 5.5 fbbc4cda5c refactor(ui): remove floating, resizable rail panels
PR #768 bundled a portable-panel windowing system with the Street Level
layer. Remove it so CCTV and Street Level are ordinary docked right-rail
panels again, as on main before the merge.

Removed:
- header drag to float, 8-way edge/corner resize, double-press snap-back,
  dockOnCollapse, command-dock clearance, float hint toast, floating z floor,
  persisted floating geometry and ResizeObserver re-clamping
  (panelPositionControls.js restored to its pre-#768 version)
- src/ui/panelResize.js and its tests, panelDock.test.mjs
- onPanelResized/dockPanel wiring in PanelChrome, the application shell and
  StreetLevelControls (EXPAND/SHRINK no longer docks)
- :not(.panel-floating) guards and .panel-floating/.panel-portable/resize CSS
- qa:panel-resize, qa-panel-resize.mjs, qa-panelDrag.mjs, their tests, the
  CI "Portable panel gate" step, QA_FAIL_ON_RETRY, and the Street Level
  gate's float/resize/dock steps
- floating-panel docs in README, CHANGELOG, CURRENT-STATE, KNOWN-ISSUES

Kept: the Street Level panel as a docked rail panel (share/cockpit/rail
lists, layout controller, rail and Cyber CSS, EXPAND viewer), and the
independent right-rail alignment fix (settledLeftRailTop, 9dde7b4).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-07 21:39:33 +04:00

98 lines
3.3 KiB
JavaScript

import { readStylesheet } from './testSupport/readStylesheet.mjs';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import test from 'node:test';
import {
shouldExpandGlobalContextPanel,
shouldHideCollapsedRightPanels,
} from './rightRailPolicy.js';
test('Tactical HUD hides collapsed right-rail siblings while one panel is expanded', () => {
assert.equal(shouldHideCollapsedRightPanels({
hudVariant: 'tactical',
hasExpandedPanel: true,
}), true);
});
test('collapsed launchers remain when Tactical has no expanded panel', () => {
assert.equal(shouldHideCollapsedRightPanels({
hudVariant: 'tactical',
hasExpandedPanel: false,
}), false);
});
test('other HUD layouts keep collapsed right-rail launchers visible', () => {
assert.equal(shouldHideCollapsedRightPanels({
hudVariant: 'minimal',
hasExpandedPanel: true,
}), false);
assert.equal(shouldHideCollapsedRightPanels({
hudVariant: 'full',
hasExpandedPanel: true,
}), false);
});
test('desktop Display participates in Tactical exclusivity without changing mobile Display behavior', () => {
const ui = readFileSync(new URL('./ui/rightPanelRail.js', import.meta.url), 'utf8');
const css = readStylesheet(new URL('../style.css', import.meta.url));
assert.match(ui, /const isMobile = windowRef\.matchMedia\('\(max-width: 720px\)'\)\.matches/);
assert.match(
ui,
/!panel\.classList\.contains\('collapsed'\)\s*&&\s*\(!isMobile \|\| panel\.id !== 'pp-toggles'\)/,
);
assert.doesNotMatch(
ui,
/panel\.id !== 'pp-toggles' && !panel\.classList\.contains\('collapsed'\)/,
);
assert.match(ui, /if \(exclusive && panel\.classList\.contains\('collapsed'\)\)\s*panel\.setAttribute\('aria-hidden', 'true'\)/);
assert.match(css, /#right-context-rail\.layout-exclusive > \[data-panel-id\]\.collapsed \{/);
});
test('explicit Contacts, Space Missions, and Cockpit actions expand Global Context after success', () => {
for (const action of ['contacts', 'space-missions', 'cockpit']) {
assert.equal(shouldExpandGlobalContextPanel({
action,
explicitUserAction: true,
succeeded: true,
}), true, `${action} should reveal its supporting context`);
}
});
test('Cockpit expansion is independent of whether a track was already selected', () => {
for (const selectedTrack of [null, 'UAL649']) {
assert.equal(shouldExpandGlobalContextPanel({
action: 'cockpit',
explicitUserAction: true,
succeeded: true,
selectedTrack,
}), true);
}
});
test('restoration and programmatic replay preserve the saved Global Context collapse state', () => {
assert.equal(shouldExpandGlobalContextPanel({
action: 'contacts',
explicitUserAction: false,
succeeded: true,
}), false);
assert.equal(shouldExpandGlobalContextPanel({
action: 'space-missions',
explicitUserAction: true,
succeeded: true,
restoring: true,
}), false);
});
test('failed or unrelated actions never expand Global Context', () => {
assert.equal(shouldExpandGlobalContextPanel({
action: 'contacts',
explicitUserAction: true,
succeeded: false,
}), false, 'a failed transition must preserve the prior panel state for rollback');
assert.equal(shouldExpandGlobalContextPanel({
action: 'search-nearby',
explicitUserAction: true,
succeeded: true,
}), false);
});