Compare commits
No commits in common. "master" and "feat/geofence-watch" have entirely different histories.
master
...
feat/geofe
3 changed files with 182 additions and 619 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
||||||
"""Geofence layer panel: draw, watch, inbox, delete (HTML contract)."""
|
"""Geofence layer panel: draw + delete (DELETE /api/geofences/{id})."""
|
||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
|
@ -24,33 +24,3 @@ def test_load_geofences_renders_delete_controls():
|
||||||
assert "deleteGeofence" in js
|
assert "deleteGeofence" in js
|
||||||
assert "onEachFeature" in js
|
assert "onEachFeature" in js
|
||||||
assert "bindPopup" in js
|
assert "bindPopup" in js
|
||||||
|
|
||||||
|
|
||||||
def test_finish_cancel_draw_controls():
|
|
||||||
assert 'id="gf-finish"' in HTML
|
|
||||||
assert 'id="gf-cancel"' in HTML
|
|
||||||
assert "function cancelGeofenceDraw" in HTML
|
|
||||||
assert "function onGfClose" in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_watch_geofences_ws_payload():
|
|
||||||
assert "watch_geofences" in HTML
|
|
||||||
assert "function sendWatchGeofences" in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_geofence_alert_inbox():
|
|
||||||
assert 'id="gf-inbox"' in HTML
|
|
||||||
assert "/api/geofence-alerts" in HTML
|
|
||||||
assert "function loadGfInbox" in HTML
|
|
||||||
assert "function pushGfInbox" in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_delete_geofence_still_present():
|
|
||||||
assert "function deleteGeofence" in HTML
|
|
||||||
assert "method: 'DELETE'" in HTML or 'method: "DELETE"' in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_fence_dvr_at_endpoint():
|
|
||||||
assert "/at?timestamp=" in HTML or "/at?timestamp=${" in HTML
|
|
||||||
assert "function dvrScrubFence" in HTML
|
|
||||||
assert "gfSelectedId" in HTML
|
|
||||||
|
|
|
||||||
|
|
@ -1,113 +0,0 @@
|
||||||
"""Quiet HUD chrome: VIIRS default, collapsed rail, no Orbitron/MKT dashes."""
|
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
ROOT = Path(__file__).resolve().parent.parent
|
|
||||||
HTML = (ROOT / "app/static/index.html").read_text()
|
|
||||||
|
|
||||||
|
|
||||||
def _attr(html: str, elem_id: str) -> str:
|
|
||||||
chunk = html.split(f'id="{elem_id}"', 1)[1].split(">", 1)[0]
|
|
||||||
return chunk
|
|
||||||
|
|
||||||
|
|
||||||
def test_initmap_prefers_viirs_true_color():
|
|
||||||
init = HTML.split("async function initMap", 1)[1].split("function readMapPrefs", 1)[0]
|
|
||||||
assert "VIIRS_SNPP_CorrectedReflectance_TrueColor" in init
|
|
||||||
assert init.index("VIIRS_SNPP_CorrectedReflectance_TrueColor") < init.index(
|
|
||||||
"MODIS_Terra_CorrectedReflectance_TrueColor"
|
|
||||||
)
|
|
||||||
assert init.index("MODIS_Terra_CorrectedReflectance_TrueColor") < init.index(
|
|
||||||
"BlueMarble_ShadedRelief_Bathymetry"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_orbitron_gone():
|
|
||||||
assert "Orbitron" not in HTML
|
|
||||||
assert "IBM Plex Sans" in HTML
|
|
||||||
assert "IBM Plex Mono" in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_lp_note_stripped_from_layer_list():
|
|
||||||
assert 'class="lp-note"' not in HTML
|
|
||||||
body = HTML.split('class="lp-body"', 1)[1].split("lp-legend", 1)[0]
|
|
||||||
assert "lp-note" not in body
|
|
||||||
|
|
||||||
|
|
||||||
def test_default_overlays_basemap_and_firms_only():
|
|
||||||
fires = _attr(HTML, "lp-fires-on")
|
|
||||||
assert "checked" in fires
|
|
||||||
for eid in (
|
|
||||||
"lp-cams-on",
|
|
||||||
"lp-blips-on",
|
|
||||||
"lp-news-on",
|
|
||||||
"lp-radar-on",
|
|
||||||
"lp-alerts-on",
|
|
||||||
"lp-perim-on",
|
|
||||||
"lp-ac-on",
|
|
||||||
"lp-trains-on",
|
|
||||||
"lp-storms-on",
|
|
||||||
):
|
|
||||||
assert "checked" not in _attr(HTML, eid), eid
|
|
||||||
|
|
||||||
|
|
||||||
def test_geofence_markup_before_cameras():
|
|
||||||
assert 'id="gf-draw"' in HTML
|
|
||||||
assert HTML.index('id="gf-draw"') < HTML.index('id="lp-cams-on"')
|
|
||||||
assert HTML.index('id="lp-base-on"') < HTML.index('id="gf-draw"')
|
|
||||||
|
|
||||||
|
|
||||||
def test_parent_geofence_hud_survives():
|
|
||||||
assert "watch_geofences" in HTML
|
|
||||||
assert "function deleteGeofence" in HTML
|
|
||||||
assert 'id="gf-finish"' in HTML
|
|
||||||
assert 'id="gf-cancel"' in HTML
|
|
||||||
assert 'id="gf-inbox"' in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_layer_rail_collapsed_on_load():
|
|
||||||
head = HTML.split('class="lp-head"', 1)[1].split("</div>", 1)[0]
|
|
||||||
assert 'aria-expanded="false"' in head
|
|
||||||
assert 'id="layer-panel" class="collapsed"' in HTML
|
|
||||||
|
|
||||||
|
|
||||||
def test_market_ticker_hidden_no_poll():
|
|
||||||
mkt = HTML.split('class="ticker market"', 1)[1].split(">", 1)[0]
|
|
||||||
assert "hidden" in mkt
|
|
||||||
assert "setInterval(probeMarket" not in HTML
|
|
||||||
assert "setInterval(loadMarket" not in HTML
|
|
||||||
init = HTML.split("function initMarketTicker", 1)[1].split("function ", 1)[0]
|
|
||||||
assert "/api/market" in init or "404-poll" in init
|
|
||||||
assert "setInterval" not in init
|
|
||||||
|
|
||||||
|
|
||||||
def test_news_ticker_fills_news_only_dock():
|
|
||||||
css = HTML.split("</style>", 1)[0]
|
|
||||||
compact = css.replace(" ", "").replace("\n", "")
|
|
||||||
assert ".dock.news-only{height:32px;}" in compact
|
|
||||||
assert ".dock.news-only.ticker{height:100%;}" in compact
|
|
||||||
assert ".ticker{display:flex;align-items:stretch;height:50%;" in compact
|
|
||||||
|
|
||||||
|
|
||||||
def test_news_pins_are_circle_markers():
|
|
||||||
js = HTML.split("async function loadNewsPins", 1)[1].split("function refreshLiveOverlays", 1)[0]
|
|
||||||
assert "L.circleMarker" in js
|
|
||||||
assert "fillOpacity: 0.7" in js or "fillOpacity:0.7" in js
|
|
||||||
assert "rotate(45deg)" not in js
|
|
||||||
assert "L.divIcon" not in js
|
|
||||||
|
|
||||||
|
|
||||||
def test_chokepoint_buttons_not_in_toolbar_flow():
|
|
||||||
assert 'id="chokepoint-select"' in HTML
|
|
||||||
css = HTML.split("</style>", 1)[0]
|
|
||||||
assert ".chokepoint-btns { display: none; }" in css or ".chokepoint-btns{display:none" in css.replace(
|
|
||||||
" ", ""
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def test_brand_is_osint_slash():
|
|
||||||
assert "GLOBAL SITUATIONAL AWARENESS TERMINAL" not in HTML
|
|
||||||
assert "OSINT" in HTML
|
|
||||||
assert 'class="accent">//</span>' in HTML
|
|
||||||
Loading…
Add table
Reference in a new issue