Keep Contact folded until both Cockpit left panels close, and keep focus in a renamed row

Opening Utilities while Data Layers is open no longer forgets that Contact
was folded for the first, and closing one of them leaves Contact folded
while the other is still open. Enter and Esc in a drawn shape's name keep
focus in the field instead of dropping it to the page. The draw tool's
destroy test now checks it stops following the board, and the Draw gate's
amber-count comment sits on its function again.
This commit is contained in:
Said Turksever committed 2026-11-02 17:01:31 +00:00
1 parent 345d5db593
commit 672a145254
7 files changed
+68 -15

No files matched your search

+24
View File
@@ -1385,3 +1385,27 @@ test('cockpit state cannot report entryAllowed while already active', () => {
assert.match(state, /'contacts-inactive'/);
assert.match(state, /'no-tracked-aircraft'/);
});
test('Contact folded for one Cockpit left panel comes back only once neither is open', async () => {
assert.match(
ui,
/if \(!this\._cockpitContextCollapsedForDataPanel\)\s*this\._cockpitContextCollapsedForDataPanel =\s*!this\.cockpitView\.contextCollapsed;/,
'opening the second left panel keeps the fold the first recorded',
);
const { PanelChrome } = await import('./ui/panelChrome.js');
const previous = globalThis.document;
const panels = {};
globalThis.document = { getElementById: (id) => panels[id] ?? null };
const panel = (...classes) => ({ classList: { contains: (name) => classes.includes(name) } });
try {
const otherOpen = (id) => PanelChrome.prototype._otherCockpitLeftPanelOpen(id);
panels['data-panel'] = panel('collapsed');
assert.equal(otherOpen('utilities-panel'), false, 'Data Layers closed: restore');
panels['data-panel'] = panel('collapsed', 'layout-auto-collapsed');
assert.equal(otherOpen('utilities-panel'), true, 'Data Layers comes back: keep Contact folded');
panels['data-panel'] = panel();
assert.equal(otherOpen('utilities-panel'), true, 'Data Layers open: keep it folded');
} finally {
globalThis.document = previous;
}
});