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