mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 18:34:02 +00:00
A panel's collapsed, dock-pinned, dock-pinned-top, layout-auto-collapsed
and accordion-collapsed classes are drawn by its root's v-panel-state from
the gev-panel-chrome store. PanelChrome, its restore, the layout
controller, both rails and the side accordion present each panel's state
there instead of writing its classes; the rails call onCollapse(panel,
{collapsed, auto}). The directive applies a change in a synchronous
watcher, since the rails measure a panel in the task that opens or closes
it.
Destroying the chrome inside Cockpit now puts back the panels Cockpit's
entry closed while it can still present them. Without a shell, the voice
tools' set_panel_open reports that there is no panel to open. QA scripts
present the states they set instead of writing the classes.
22 lines
775 B
JavaScript
22 lines
775 B
JavaScript
// src/testSupport/panelState.mjs — present a panel's state the way the shell
|
|
// does (PanelChrome._presentPanel), drawn at once as its root's v-panel-state
|
|
// would, for fixtures whose panels are plain objects with a classList.
|
|
import { applyPanelState, readPanelState } from '../ui/rail/panelState.js';
|
|
|
|
/**
|
|
* @param {object|string} panelOrId A panel, or its id in `documentRef`.
|
|
* @param {object} [patch] The state that changes.
|
|
* @param {Document} [documentRef]
|
|
*/
|
|
export function presentPanelLocally(
|
|
panelOrId,
|
|
patch = {},
|
|
documentRef = globalThis.document,
|
|
) {
|
|
const panel =
|
|
typeof panelOrId === 'string'
|
|
? documentRef?.getElementById(panelOrId)
|
|
: panelOrId;
|
|
if (panel) applyPanelState(panel, { ...readPanelState(panel), ...patch });
|
|
}
|