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
+16 -3
View File
@@ -60,8 +60,8 @@ def test_unified_console_exposes_device_id_based_nfc_authorization() -> None:
assert '.v2-nfc-command-list' in styles
assert '.v2-nfc-command-option' in styles
assert '.v2-nfc-select-all' in styles
assert 'self-extension.js?v=pet-acrylic-48' in html
assert 'self-extension.css?v=pet-acrylic-48' in html
assert 'self-extension.js?v=pet-settings-49' in html
assert 'self-extension.css?v=pet-settings-49' in html
def test_unified_console_exposes_gscu_tcp_configuration_and_actions() -> None:
@@ -134,7 +134,7 @@ def test_server_exposes_nfc_snapshot_through_same_origin_extension_api() -> None
assert "frame-src 'self' http://*:3001" in server
def test_homepage_exposes_durable_editable_pet_cards_and_nfc_only_binding() -> None:
def test_pet_settings_dialog_edits_durable_cards_and_homepage_only_shows_detected_pet() -> None:
script = source("self-extension.js")
styles = source("self-extension.css")
service = (ROOT / "src" / "cognitive_agent" / "application" / "pet_cards.py").read_text(
@@ -145,6 +145,16 @@ def test_homepage_exposes_durable_editable_pet_cards_and_nfc_only_binding() -> N
).read_text(encoding="utf-8")
assert 'class="v2-pet-card-region"' in script
assert 'id="extensionPetSettingsDialog"' in script
assert 'data-open-pet-settings' in script
assert 'function renderPetCardEditor()' in script
assert 'function renderPetSettingsDialog()' in script
assert 'function bindPetSettingsDialogEvents()' in script
assert 'function renderDetectedPetCard(card)' in script
assert 'mount.dataset.hasPets = String(Boolean(nfcPet))' in script
assert '${nfcPet ? renderDetectedPetCard(nfcPet) : ""}' in script
assert '${renderPetCardRegion()}' not in script
assert 'function renderPetCardRegion()' not in script
assert 'data-pet-field="pet_name"' in script
assert 'data-pet-field="action"' in script
assert '<output>${card.nfc_id ?' in script
@@ -165,6 +175,9 @@ def test_homepage_exposes_durable_editable_pet_cards_and_nfc_only_binding() -> N
assert 'if (nextRevision < petCardSnapshot.revision) return false' in script
assert '.v2-pet-card-region' in styles
assert '.v2-pet-card-list' in styles
assert '.v2-pet-settings-dialog' in styles
assert '.v2-pet-settings-body' in styles
assert '.v2-pet-presence-card' in styles
assert '.v2-nfc-pet-binding' in styles
assert 'grid-template-columns: minmax(0, 1fr);' in styles
assert 'scrollbar-gutter: stable' in styles