mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
feat(panels): build the rail panels on one UiPanel
The Data, Authoring, Weather, Recent Imagery, Context, CCTV, Street Level and Radio panels each wrote the same frame by hand. They are now one kit component, UiPanel, with a title, badge/actions/default slots and v-model:collapsed, drawing Core's panel markup and classes beside the kit's; props cover the differences (sideways, glow, scroll, railScroller, tag, toggleWords). RailPanel binds it to the panel chrome store: v-panel-state writes its state classes at once, and its button's clicks reach PanelChrome. UiPanelToggle is the collapse button UiPanel and PanelCollapseButton share. UiPanel's collapsed drives the button and ui-panel--collapsed only; the owner hides the body by writing the root's collapsed class, since the rails measure a panel in the task that opens it. PanelCollapseButton takes startCollapsed instead of initial and initialTitle, so a button shows its state's glyph and words before startup presents the panel. Titles render through t() instead of data-i18n, and the unused "Expand panel" string is pruned. v-panel-state redraws the presented state after a re-render, in case a root's class binding ever changes.
This commit is contained in:
1 parent
a3fc475cbe
commit
cd231faae9
30 files changed
+427
-197
No files matched your search
@@ -53,7 +53,10 @@ function fixture(t) {
|
||||
test('before ContextControls renders, the switch shows its initial markup', (t) => {
|
||||
const { $ } = fixture(t);
|
||||
const panel = $('global-context-panel');
|
||||
assert.equal(panel.className, 'panel-collapsible collapsed');
|
||||
assert.equal(
|
||||
panel.className,
|
||||
'ui-panel panel-collapsible collapsed ui-panel--collapsed',
|
||||
);
|
||||
assert.equal(panel.hasAttribute('data-context-mode'), false);
|
||||
for (const id of [
|
||||
'global-context-flights-btn',
|
||||
@@ -118,14 +121,21 @@ test('the panel carries the mode beside the classes its chrome writes', async (t
|
||||
panel.classList.remove('collapsed');
|
||||
controls._contextMode = 'flights';
|
||||
await sync();
|
||||
assert.equal(panel.className, 'panel-collapsible context-enabled');
|
||||
// Without an owner the button, and the kit class, keep the start state.
|
||||
assert.equal(
|
||||
panel.className,
|
||||
'ui-panel panel-collapsible ui-panel--collapsed context-enabled',
|
||||
);
|
||||
assert.equal(panel.getAttribute('data-context-mode'), 'flights');
|
||||
assert.equal($('context-flights-view').hidden, false);
|
||||
|
||||
panel.classList.add('collapsed');
|
||||
controls._contextMode = null;
|
||||
await sync();
|
||||
assert.equal(panel.className, 'panel-collapsible collapsed');
|
||||
assert.equal(
|
||||
panel.className,
|
||||
'ui-panel panel-collapsible ui-panel--collapsed collapsed',
|
||||
);
|
||||
assert.equal(panel.getAttribute('data-context-mode'), 'none');
|
||||
assert.equal($('context-mode-standby').hidden, false);
|
||||
assert.equal($('context-flights-view').hidden, true);
|
||||
|
||||
Reference in new issue
Block a user