test: MapLive.Index event edge cases + clear_and_reload at low zoom
This commit is contained in:
parent
e50e7675da
commit
4c94dc3059
1 changed files with 75 additions and 0 deletions
|
|
@ -606,6 +606,81 @@ defmodule AprsmeWeb.MapLive.IndexTest do
|
|||
assert render(view) =~ "aprs-map"
|
||||
end
|
||||
|
||||
test "update_trail_duration at low zoom while tracking a callsign", %{conn: conn} do
|
||||
{:ok, view, _html} =
|
||||
live(conn, "/TRACK1?lat=33.0&lng=-96.0&z=5", on_error: :warn)
|
||||
|
||||
assert render_hook(view, "update_trail_duration", %{"trail_duration" => "2"})
|
||||
end
|
||||
|
||||
test "update_historical_hours when map_ready triggers reload", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
|
||||
render_hook(view, "map_ready", %{})
|
||||
Process.sleep(20)
|
||||
|
||||
assert render_hook(view, "update_historical_hours", %{"historical_hours" => "6"})
|
||||
end
|
||||
|
||||
test "clear_and_reload_markers at low zoom (heat map path)", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/?lat=33.0&lng=-96.0&z=5", on_error: :warn)
|
||||
# At zoom 5, clear_and_reload_markers uses the heat map branch.
|
||||
assert render_hook(view, "clear_and_reload_markers", %{})
|
||||
end
|
||||
|
||||
test "clear_and_reload_markers at high zoom (marker path)", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/?lat=33.0&lng=-96.0&z=12", on_error: :warn)
|
||||
assert render_hook(view, "clear_and_reload_markers", %{})
|
||||
end
|
||||
|
||||
test "set_location with invalid coords is ignored safely", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
|
||||
# Invalid-range coords should be rejected by UrlParams.valid_coordinates?
|
||||
assert render_hook(view, "set_location", %{"lat" => 999, "lng" => 999})
|
||||
end
|
||||
|
||||
test "set_location with string coords", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
assert render_hook(view, "set_location", %{"lat" => "40.7", "lng" => "-74.0"})
|
||||
end
|
||||
|
||||
test "marker_hover_start with a path of digipeaters (no positions)", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
|
||||
assert render_hook(view, "marker_hover_start", %{
|
||||
"id" => "x",
|
||||
"path" => "WIDE1-1,WIDE2-2,K5ABC*",
|
||||
"lat" => 33.0,
|
||||
"lng" => -96.0
|
||||
})
|
||||
end
|
||||
|
||||
test "marker_hover_start followed by marker_hover_end cancels timer", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
|
||||
render_hook(view, "marker_hover_start", %{
|
||||
"id" => "x",
|
||||
"path" => "WIDE1-1",
|
||||
"lat" => 33.0,
|
||||
"lng" => -96.0
|
||||
})
|
||||
|
||||
assert render_hook(view, "marker_hover_end", %{})
|
||||
# Starting hover again cancels the pending clear timer.
|
||||
assert render_hook(view, "marker_hover_start", %{
|
||||
"id" => "y",
|
||||
"path" => "WIDE2-2",
|
||||
"lat" => 34.0,
|
||||
"lng" => -97.0
|
||||
})
|
||||
end
|
||||
|
||||
test "update_callsign sets overlay_callsign", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
assert render_hook(view, "update_callsign", %{"callsign" => "N0CALL"})
|
||||
end
|
||||
|
||||
test "handles drain_connections with small to_drain value", %{conn: conn} do
|
||||
{:ok, view, _html} = live(conn, "/", on_error: :warn)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue