defmodule TrackerWeb.SectionHeaderTest do use TrackerWeb.ConnCase, async: true import Phoenix.LiveViewTest import Phoenix.Component, only: [sigil_H: 2] alias TrackerWeb.SectionHeader describe "section_header/1" do test "renders the title, a rule, and the count" do assigns = %{} html = rendered_to_string(~H""" """) assert html =~ ~s(class="section-header") assert html =~ "

Packages

" assert html =~ ~s() assert html =~ ~s(3) end test "renders without a count" do assigns = %{} html = rendered_to_string(~H""" """) assert html =~ ~s(class="section-header package-show__panel-header") refute html =~ ~s(class="n") end test "renders controls between the rule and the count" do assigns = %{} html = rendered_to_string(~H""" <:controls> """) assert html =~ ~s() end test "omits the controls wrapper when no controls are given" do assigns = %{} html = rendered_to_string(~H""" """) refute html =~ "section-controls" end end end