feat: 完善 N7 智能座舱交互与控制链路
This commit is contained in:
@@ -16,16 +16,17 @@ def test_shadcn_semantic_theme_tokens_drive_the_console() -> None:
|
||||
speech = source("speech-input.css")
|
||||
|
||||
expected_tokens = {
|
||||
"--background: oklch(1 0 0)",
|
||||
"--foreground: oklch(0.145 0.008 326)",
|
||||
"--primary: oklch(0.488 0.243 264.376)",
|
||||
"--primary-foreground: oklch(0.97 0.014 254.604)",
|
||||
"--destructive: oklch(0.577 0.245 27.325)",
|
||||
"--sidebar-primary: oklch(0.546 0.245 262.881)",
|
||||
"--background: oklch(0.145 0.008 326)",
|
||||
"--foreground: oklch(0.985 0 0)",
|
||||
"--primary: oklch(0.424 0.199 265.638)",
|
||||
"--sidebar-primary: oklch(0.623 0.214 259.815)",
|
||||
"--background: oklch(0.968 0.019 244)",
|
||||
"--foreground: oklch(0.29 0.042 252)",
|
||||
"--card-foreground: oklch(0.34 0.032 250)",
|
||||
"--primary: oklch(0.57 0.19 258)",
|
||||
"--primary-foreground: oklch(0.99 0.004 245)",
|
||||
"--destructive: oklch(0.61 0.19 24)",
|
||||
"--sidebar-primary: oklch(0.57 0.19 258)",
|
||||
"--background: oklch(0.2 0.035 252)",
|
||||
"--foreground: oklch(0.94 0.02 245)",
|
||||
"--primary: oklch(0.7 0.15 252)",
|
||||
"--sidebar-primary: oklch(0.7 0.15 252)",
|
||||
}
|
||||
token_lines = {line.strip() for line in styles.replace(";", "").splitlines()}
|
||||
assert expected_tokens <= token_lines
|
||||
@@ -40,14 +41,14 @@ def test_theme_asset_versions_are_consistent_with_the_pwa_shell() -> None:
|
||||
service_worker = source("service-worker.js")
|
||||
|
||||
for asset in (
|
||||
"/styles.css?v=dual-seat-21",
|
||||
"/console-v2.css?v=delivery-state-50",
|
||||
"/self-extension.css?v=gscu-tcp-42",
|
||||
"/speech-input.css?v=sensevoice-5",
|
||||
"/styles.css?v=dual-seat-23",
|
||||
"/console-v2.css?v=delivery-state-65",
|
||||
"/self-extension.css?v=gscu-tcp-43",
|
||||
"/speech-input.css?v=sensevoice-7",
|
||||
):
|
||||
assert asset in html
|
||||
assert f'"{asset}"' in service_worker
|
||||
assert 'const CACHE_VERSION = "cognitive-agent-pad-v228"' in service_worker
|
||||
assert 'const CACHE_VERSION = "cognitive-agent-pad-v269"' in service_worker
|
||||
|
||||
|
||||
def test_vehicle_twin_icons_and_nested_overlays_use_semantic_tokens() -> None:
|
||||
@@ -94,6 +95,13 @@ def test_operator_controls_share_status_and_typography_tokens() -> None:
|
||||
for token in (
|
||||
"--status-online:",
|
||||
"--status-offline:",
|
||||
"--status-info:",
|
||||
"--status-success:",
|
||||
"--status-warning:",
|
||||
"--status-error:",
|
||||
"--heading-foreground:",
|
||||
"--body-foreground:",
|
||||
"--subtle-foreground:",
|
||||
"--text-caption:",
|
||||
"--text-control:",
|
||||
"--text-input:",
|
||||
@@ -106,7 +114,7 @@ def test_operator_controls_share_status_and_typography_tokens() -> None:
|
||||
assert 'id="modeRailContent"' in html
|
||||
assert 'role="region"' in html
|
||||
assert 'aria-label="功能模式列表"' in html
|
||||
assert '<span>自定义</span>' in html
|
||||
assert '<span>AI 新建</span>' in html
|
||||
assert "模拟下发" in html
|
||||
assert "真实下发" in html
|
||||
assert 'id="simulationMode"' not in html
|
||||
@@ -162,21 +170,24 @@ def test_function_modes_use_an_inline_accessible_collapsible() -> None:
|
||||
console = source("console-v2.css")
|
||||
|
||||
assert '<div class="mode-rail-bar">' in html
|
||||
assert 'id="modeRailSelection">常用模式</span>' in html
|
||||
assert 'id="modeRailSelection">静态模式</span>' in html
|
||||
assert 'id="modeGalleryToggle"' in html
|
||||
assert '<span>自定义</span>' in html
|
||||
assert 'class="mode-rail-identity"' in html
|
||||
assert '<span>AI 新建</span>' in html
|
||||
assert 'aria-expanded="true"' in html
|
||||
assert '<details class="mode-rail"' not in html
|
||||
assert 'class="mode-rail-dropdown"' not in html
|
||||
assert 'toggle.setAttribute("aria-expanded", String(open))' in app
|
||||
assert "content.hidden = !open" in app
|
||||
assert 'mainPanel.insertBefore(modeRail, output)' in source("console-v2.js")
|
||||
assert 'grid-column: 1 / -1' in source("assistant-chat.css")
|
||||
assert 'document.body.classList.toggle("mode-rail-expanded", open)' not in app
|
||||
assert 'document.addEventListener("pointerdown"' in app
|
||||
assert '.v2-mode-rail > .mode-rail-content[hidden]' in console
|
||||
compact_styles = console.split("/* Compact function-mode strip", 1)[1]
|
||||
assert '.mode-rail-content[hidden]' in compact_styles
|
||||
assert ".mode-rail-expanded .main-panel" not in console
|
||||
assert "position: absolute" in console
|
||||
assert "top: calc(100% + 8px)" in console
|
||||
assert "overflow-y: auto" in console
|
||||
assert "scrollbar-gutter: stable" in console
|
||||
assert "position: static" in compact_styles
|
||||
assert "overflow-x: auto" in compact_styles
|
||||
assert "min-height: 54px" in compact_styles
|
||||
|
||||
|
||||
def test_vehicle_device_cards_hide_stale_values_without_signal() -> None:
|
||||
@@ -219,3 +230,23 @@ def test_all_five_output_modules_are_covered_by_the_final_theme_layer() -> None:
|
||||
assert "--config-accent: var(--primary)" in final_layer
|
||||
assert "background: var(--card)" in final_layer
|
||||
assert "border-color: var(--border)" in final_layer
|
||||
|
||||
|
||||
def test_ai_light_blue_theme_closes_after_legacy_color_layers() -> None:
|
||||
console = source("console-v2.css")
|
||||
assistant = source("assistant-chat.css")
|
||||
extension = source("self-extension.css")
|
||||
|
||||
assert console.rfind("/* AI assistant light-blue final override") > console.rfind(
|
||||
"/* Final semantic theme cascade"
|
||||
)
|
||||
assert assistant.rfind("/* Shared AI light-blue palette") > assistant.rfind(
|
||||
"@media (prefers-reduced-motion: reduce)"
|
||||
)
|
||||
assert extension.rfind("/* AI light-blue closure") > extension.rfind(
|
||||
"/* Final semantic theme layer for extension surfaces"
|
||||
)
|
||||
assert "color: var(--body-foreground)" in console
|
||||
assert "color: var(--subtle-foreground)" in console
|
||||
assert "background: var(--status-success-soft)" in assistant
|
||||
assert "background: var(--primary)" in assistant
|
||||
|
||||
Reference in New Issue
Block a user