stackchain-dashboard/tests/test_panel_persistence.py
timmy 6e6e63e553
All checks were successful
CI / lint (pull_request) Successful in 29s
CI / build-frontend (pull_request) Successful in 4s
security: enforce strict browser execution boundary (#295)
2026-08-08 11:38:18 +00:00

25 lines
850 B
Python

from pathlib import Path
from tests.dashboard_bundle import dashboard_bundle_text
DASHBOARD = Path("frontend/index.html")
def test_dashboard_panels_are_independently_collapsible():
html = dashboard_bundle_text()
for panel_key in ("context", "ai-stream", "issues", "pull-requests", "widgets", "layout", "markdown"):
assert f'<details class="panel' in html
assert f'data-panel-key="{panel_key}"' in html
def test_panel_open_state_is_restored_and_saved_in_local_storage():
html = dashboard_bundle_text()
assert 'const PANEL_STATE_KEY = "stackchain.panel-state.v1"' in html
assert "localStorage.getItem(PANEL_STATE_KEY)" in html
assert "panel.open = savedState[panel.dataset.panelKey]" in html
assert "localStorage.setItem(PANEL_STATE_KEY" in html
assert "panel.addEventListener('toggle'" in html