- Delete dead config keys and test file (typo'd aprsme_is_*, vacuous disable test) - Remove duplicate function clauses and identical function pairs - Rename misleading one_hour_ago variable to one_day_ago - Strip stale Oban comment - Remove TestHelpers time function duplicates - Inline Aprsme.Schema module (only 1 caller) - Deduplicate prod esbuild config - Thin SymbolRenderer delegations, inline TimeUtils wrappers - Remove redundant DeploymentNotifier GenServer polling - Replace random fallback in get_callsign_key with sentinel
67 lines
1.9 KiB
Elixir
67 lines
1.9 KiB
Elixir
defmodule AprsmeWeb.SymbolRendererTest do
|
|
use ExUnit.Case, async: true
|
|
|
|
import Phoenix.LiveViewTest
|
|
|
|
alias AprsmeWeb.SymbolRenderer
|
|
|
|
describe "symbol/1 component" do
|
|
test "renders a container with the given size" do
|
|
html = render_component(&SymbolRenderer.symbol/1, symbol_table: "/", symbol_code: ">", size: 48)
|
|
assert html =~ "aprs-symbol-container"
|
|
assert html =~ "width: 48px"
|
|
assert html =~ "height: 48px"
|
|
end
|
|
|
|
test "includes default size (32px) when size not specified" do
|
|
html = render_component(&SymbolRenderer.symbol/1, symbol_table: "/", symbol_code: ">")
|
|
assert html =~ "width: 32px"
|
|
assert html =~ "height: 32px"
|
|
end
|
|
|
|
test "renders a callsign label when provided" do
|
|
html =
|
|
render_component(&SymbolRenderer.symbol/1,
|
|
symbol_table: "/",
|
|
symbol_code: ">",
|
|
callsign: "W1AW"
|
|
)
|
|
|
|
assert html =~ "W1AW"
|
|
assert html =~ "aprs-callsign-label"
|
|
end
|
|
|
|
test "does not render a callsign label when nil" do
|
|
html = render_component(&SymbolRenderer.symbol/1, symbol_table: "/", symbol_code: ">")
|
|
refute html =~ "aprs-callsign-label"
|
|
end
|
|
|
|
test "uses explicit title when provided" do
|
|
html =
|
|
render_component(&SymbolRenderer.symbol/1,
|
|
symbol_table: "/",
|
|
symbol_code: ">",
|
|
title: "Custom title"
|
|
)
|
|
|
|
assert html =~ "Custom title"
|
|
end
|
|
|
|
test "derives title from symbol_table and symbol_code when no explicit title" do
|
|
html = render_component(&SymbolRenderer.symbol/1, symbol_table: "/", symbol_code: ">")
|
|
# ">" is HTML-escaped to ">"
|
|
assert html =~ ~s(title="/>")
|
|
end
|
|
|
|
test "passes additional class through" do
|
|
html =
|
|
render_component(&SymbolRenderer.symbol/1,
|
|
symbol_table: "/",
|
|
symbol_code: ">",
|
|
class: "extra-class"
|
|
)
|
|
|
|
assert html =~ "extra-class"
|
|
end
|
|
end
|
|
end
|