feat: integrate safer vehicle CAN reasoning

This commit is contained in:
vee
2026-08-12 22:50:55 +08:00
parent 9ce64b3a01
commit fd3c219c39
15 changed files with 1768 additions and 30 deletions
@@ -0,0 +1,31 @@
from __future__ import annotations
from pathlib import Path
import unittest
REPOSITORY_ROOT = Path(__file__).resolve().parents[2]
CONSOLE_SOURCE = REPOSITORY_ROOT / "apps" / "web-console" / "console-v2.js"
CONSOLE_STYLES = REPOSITORY_ROOT / "apps" / "web-console" / "console-v2.css"
class FrontendReasoningLayoutContractTests(unittest.TestCase):
def test_reasoning_control_is_removed_from_fixed_height_request_form(self) -> None:
source = CONSOLE_SOURCE.read_text(encoding="utf-8")
self.assertIn('const reasoningField = $("#reasoningField", originalForm);', source)
self.assertIn('reasoningField.classList.add("v2-reasoning-field");', source)
self.assertIn("composer.append(trigger);", source)
self.assertIn("document.body.append(reasoningField);", source)
self.assertIn('trigger.setAttribute("aria-haspopup", "listbox");', source)
def test_v2_reasoning_control_has_compact_bounded_layout(self) -> None:
styles = CONSOLE_STYLES.read_text(encoding="utf-8")
self.assertIn(".console-v2 .v2-reasoning-field .reasoning-segmented", styles)
self.assertIn(".console-v2 .v2-reasoning-trigger", styles)
self.assertIn("position: fixed;", styles)
self.assertIn("min-height: 42px;", styles)
self.assertIn("white-space: nowrap;", styles)
if __name__ == "__main__":
unittest.main()