Brain-5D-Space / tests /test_dashboard_shell.py
github-actions[bot]
Sync: publish Space API fix
5e0b58b
Raw History Blame Contribute Delete
2.28 kB
from pathlib import Path
# fmt: off
STATIC = Path(__file__).parents[1] / "src" / "dashboard" / "static"
TABS = (
"overview",
"network",
"control",
"research",
"gate",
"settings",
"embodiment",
)
def test_dashboard_shell_covers_every_primary_tab() -> None:
source = (STATIC / "dashboard-shell.js").read_text(encoding="utf-8")
for tab in TABS:
assert f"{tab}:" in source
assert "tab-${tabName}" in source
def test_dashboard_shell_is_full_width_and_responsive() -> None:
css = (STATIC / "dashboard-shell.css").read_text(encoding="utf-8")
assert "max-width: none !important" in css
assert "grid-template-columns: repeat(7, minmax(0, 1fr))" in css
assert "@media (max-width: 1180px)" in css
assert "@media (max-width: 820px)" in css
assert "@media (max-width: 520px)" in css
assert "prefers-reduced-motion" in css
def test_dashboard_shell_has_dark_and_light_design_contracts() -> None:
css = (STATIC / "dashboard-shell.css").read_text(encoding="utf-8")
assert ":root {" in css
assert "data-theme" in css
assert "light" in css
assert "--shell-surface" in css
assert "--shell-text" in css
assert "--shell-accent" in css
def test_dashboard_shell_does_not_issue_runtime_commands() -> None:
source = (STATIC / "dashboard-shell.js").read_text(encoding="utf-8")
assert "fetch(" not in source
assert "XMLHttpRequest" not in source
def test_dashboard_shell_is_loaded_from_main_dashboard_module_graph() -> None:
console_log = (STATIC / "console-log.js").read_text(encoding="utf-8")
app = (STATIC / "app.js").read_text(encoding="utf-8")
assert "dashboard-shell.js" in console_log
assert "console-log.js" in app
def test_dashboard_tabs_are_hidden_before_external_styles_load() -> None:
html = (STATIC / "index.html").read_text(encoding="utf-8")
assert ".tab-content { display: none; }" in html
assert ".tab-content.active { display: block; }" in html
def test_print_styles_do_not_capture_screen_rules() -> None:
css = (STATIC / "styles.css").read_text(encoding="utf-8")
assert "color: black !important;\n }\n}\n\n/* ============================================================================\n BIBTEX VIEWER" in css
# fmt: on