feat(n7web): add pet settings and day night themes

This commit is contained in:
Miayui
2026-09-14 17:12:08 +08:00
parent aa6f59d3a6
commit 58f1a2da42
13 changed files with 901 additions and 114 deletions
+22 -4
View File
@@ -42,20 +42,29 @@ def test_theme_asset_versions_are_consistent_with_the_pwa_shell() -> None:
for asset in (
"/styles.css?v=dual-seat-23",
"/console-v2.css?v=delivery-state-69",
"/self-extension.css?v=pet-acrylic-48",
"/self-extension.css?v=pet-settings-49",
"/speech-input.css?v=sensevoice-7",
"/codepen-glass-theme.css?v=creative-cloud-1",
"/codepen-glass-theme.css?v=creative-cloud-2",
):
assert asset in html
assert f'"{asset}"' in service_worker
assert 'const CACHE_VERSION = "cognitive-agent-pad-v298"' in service_worker
assert 'const CACHE_VERSION = "cognitive-agent-pad-v302"' in service_worker
def test_reference_glass_theme_covers_the_complete_workspace() -> None:
html = source("index.html")
theme = source("codepen-glass-theme.css")
app = source("app.js")
assert '<meta name="theme-color" content="#17182b" />' in html
assert '<meta name="theme-color" content="#17182b" id="themeColorMeta" />' in html
assert 'const key = "cognitive-agent.glass-theme"' in html
assert 'id="glassThemeToggle"' in html
assert 'data-theme-icon="sun"' in html
assert 'data-theme-icon="moon"' in html
assert 'const GLASS_THEME_STORAGE_KEY = "cognitive-agent.glass-theme"' in app
assert "localStorage.setItem(GLASS_THEME_STORAGE_KEY, normalized)" in app
assert "document.cookie = `${GLASS_THEME_STORAGE_KEY}=${normalized}" in app
assert 'new CustomEvent("cognitive-agent:theme-change"' in app
for contract in (
"--glass-shell:",
"--glass-panel:",
@@ -66,11 +75,20 @@ def test_reference_glass_theme_covers_the_complete_workspace() -> None:
".joint-twin-shell > .twin-band",
"#v2ExtensionPanel .v2-extension-sync-mount",
".v2-pet-card",
".v2-pet-presence-card",
".v2-pet-settings-dialog",
".mode-gallery",
".v2-nfc-dialog",
".energy-monitor-page",
):
assert contract in theme
assert 'html[data-glass-theme="light"] body.console-v2' in theme
assert ".glass-theme-toggle" in theme
assert "width: 100vw !important" in theme
assert "height: 100dvh !important" in theme
assert "margin: 0 !important" in theme
assert "border: 0 !important" in theme
assert "border-radius: 0 !important" in theme
def test_vehicle_twin_icons_and_nested_overlays_use_semantic_tokens() -> None: