fix ui view

This commit is contained in:
javad committed 2026-09-17 09:41:15 +03:30
1 parent 863ca89485
commit 83f4d7c728
9 files changed
+182 -17

No files matched your search

+19 -1
View File
@@ -442,10 +442,27 @@ def test_ticket_polling_javascript_keeps_background_sync_and_recovers_reliably()
source_css=Path("static/src/tailwind.css").read_text(encoding="utf-8")
assert ".staff-ticket-workspace .composer.is-collapsed{position:fixed" not in source_css
assert ".staff-ticket-workspace .composer:not(.is-collapsed){position:fixed" not in source_css
assert "max-height:min(45dvh,28rem)" in source_css
assert "max-height:min(45svh,max(7rem,calc(var(--visual-viewport-height,100svh) - 18rem)),28rem)" in source_css
for menu_feature in ("data-message-menu","data-message-menu-close","closeMessageMenu","event.key==='Escape'","!menu.contains(event.target)"):
assert menu_feature in script or menu_feature in Path("templates/tickets/_messages.html").read_text(encoding="utf-8")
def test_ticket_workspace_uses_mobile_viewport_and_keyboard_safe_layout_contract():
base=Path("templates/base.html").read_text(encoding="utf-8")
source_css=Path("static/src/tailwind.css").read_text(encoding="utf-8")
ui_script=Path("static/js/ui.js").read_text(encoding="utf-8")
conversation_script=Path("static/js/conversation.js").read_text(encoding="utf-8")
magic_template=Path("templates/tickets/customer_detail.html").read_text(encoding="utf-8")
assert "interactive-widget=resizes-content" in base
for feature in ("100svh","--visual-viewport-height","overscroll-behavior:none","display-mode:standalone"):
assert feature in source_css
assert "min-height:32rem" not in source_css
assert "max-height:min(45svh,max(7rem,calc(var(--visual-viewport-height,100svh) - 18rem)),28rem)" in source_css
for feature in ("window.visualViewport","--visual-viewport-height","appviewportchange","orientationchange"):
assert feature in ui_script
assert "layoutObserver?.observe(composer)" in conversation_script
assert "focus({preventScroll:true})" in conversation_script
assert '<footer class="ticket-detail-credit">{{ developer_credit }}</footer>' in magic_template
def test_frontend_runtime_libraries_are_local_and_versioned():
template=Path("templates/base.html").read_text(encoding="utf-8")
assert "unpkg.com" not in template
@@ -527,6 +544,7 @@ def test_pwa_prompt_is_mobile_only_and_uses_square_app_icon(client):
script=Path("static/js/pwa.js").read_text(encoding="utf-8")
manifest=client.get(reverse("web_manifest")).json()
assert "mobileDevice" in script and "banner&&mobileDevice" in script
assert "hasWorkerController=Boolean(navigator.serviceWorker.controller)" in script
assert all(icon["src"].endswith("pwa-icon.png") for icon in manifest["icons"])