60 lines
1.9 KiB
Python
60 lines
1.9 KiB
Python
|
|
"""Right-click place dossier HUD contract."""
|
|||
|
|
|
|||
|
|
from __future__ import annotations
|
|||
|
|
|
|||
|
|
from pathlib import Path
|
|||
|
|
|
|||
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|||
|
|
HTML = (ROOT / "app/static/index.html").read_text()
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_place_dossier_panel_markup():
|
|||
|
|
assert 'id="place-dossier"' in HTML
|
|||
|
|
assert "What’s here?" in HTML or "What's here?" in HTML
|
|||
|
|
assert 'id="pd-nearby"' in HTML
|
|||
|
|
assert 'id="pd-close"' in HTML
|
|||
|
|
assert 'role="dialog"' in HTML
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_place_dossier_uses_backend_nominatim_proxy():
|
|||
|
|
js = HTML.split("async function openPlaceDossier", 1)[1].split(
|
|||
|
|
"/* ═══════════════ INITIAL LOAD", 1
|
|||
|
|
)[0]
|
|||
|
|
assert "/api/place?lat=" in js
|
|||
|
|
assert "nominatim.openstreetmap.org" not in js
|
|||
|
|
assert "/api/aircraft" not in js
|
|||
|
|
assert "/api/vessels" not in js
|
|||
|
|
assert "/api/cameras" not in js
|
|||
|
|
assert "/api/fires" not in js
|
|||
|
|
assert "/api/weather-alerts" not in js
|
|||
|
|
assert "/api/infrastructure" not in js
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_place_dossier_scans_loaded_overlays_5km():
|
|||
|
|
assert "const PLACE_PAD_KM = 5" in HTML
|
|||
|
|
assert "function collectNearby" in HTML
|
|||
|
|
assert "lastCams" in HTML
|
|||
|
|
assert "lastAircraft" in HTML
|
|||
|
|
assert "lastVessels" in HTML
|
|||
|
|
assert "lastFires" in HTML
|
|||
|
|
assert "lastAlerts" in HTML
|
|||
|
|
assert "function haversineKm" in HTML
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_place_dossier_right_click_and_long_press():
|
|||
|
|
assert "map.on('contextmenu'" in HTML
|
|||
|
|
assert "function bindPlaceLongPress" in HTML
|
|||
|
|
assert "function closePlaceDossier" in HTML
|
|||
|
|
assert "Escape" in HTML.split("function initMap", 1)[1][:8000] or "Escape" in HTML.split(
|
|||
|
|
"bindPlaceLongPress(map)", 1
|
|||
|
|
)[0][-500:]
|
|||
|
|
|
|||
|
|
|
|||
|
|
def test_place_dossier_mobile_is_bottom_sheet():
|
|||
|
|
mobile = HTML.split("@media (max-width: 820px)")[1].split(
|
|||
|
|
"@media (prefers-reduced-motion"
|
|||
|
|
)[0]
|
|||
|
|
assert "#place-dossier" in mobile
|
|||
|
|
assert "bottom: 56px" in mobile
|
|||
|
|
assert "max-height: 36vh" in mobile
|