Packages
Write pipeable, fast, and easy-to-read feature tests for your Phoenix apps in a unified way -- regardless of whether you're testing LiveView pages or static pages.
Current section
Files
Jump to
Current section
Files
lib/phoenix_test/element.ex
defmodule PhoenixTest.Element do
@moduledoc false
def build_selector({tag, attributes, _}) do
Enum.reduce_while(attributes, tag, fn
{"id", id}, _ when is_binary(id) -> {:halt, "##{id}"}
{"class", _}, acc -> {:cont, acc}
{k, v}, acc -> {:cont, acc <> "[#{k}=#{inspect(v)}]"}
end)
end
end