Icons correctly implement Phoenix.HTML.Safe
This commit is contained in:
@ -7,25 +7,35 @@ defmodule HeroiconsTest do
|
||||
|> Path.join("outline/academic-cap.svg")
|
||||
|> File.read!()
|
||||
|
||||
assert Heroicons.Outline.academic_cap() == academic_cap
|
||||
assert Heroicons.Outline.academic_cap()
|
||||
|> Phoenix.HTML.safe_to_string() ==
|
||||
academic_cap
|
||||
|
||||
assert TestIcons.academic_cap(class: "h-6 w-6 text-gray-500") =~
|
||||
assert Heroicons.Outline.academic_cap(class: "h-6 w-6 text-gray-500")
|
||||
|> Phoenix.HTML.safe_to_string() =~
|
||||
~s(class="h-6 w-6 text-gray-500")
|
||||
|
||||
assert Heroicons.Outline.academic_cap(class: "<> \" ")
|
||||
|> Phoenix.HTML.safe_to_string() =~
|
||||
~s(class="<> ")
|
||||
end
|
||||
|
||||
test "generated docs" do
|
||||
{:docs_v1, _annotation, _beam_language, _format, _module_doc,
|
||||
_metadata, docs} = Code.fetch_docs(Heroicons.Outline)
|
||||
{:docs_v1, _annotation, _beam_language, _format, _module_doc, _metadata, docs} =
|
||||
Code.fetch_docs(Heroicons.Outline)
|
||||
|
||||
doc = Enum.find_value(docs, fn {{:function, :academic_cap, 1}, _annotation, _signature, doc, _metadata} -> doc
|
||||
_ -> nil end)
|
||||
doc =
|
||||
Enum.find_value(docs, fn
|
||||
{{:function, :academic_cap, 1}, _annotation, _signature, doc, _metadata} -> doc
|
||||
_ -> nil
|
||||
end)
|
||||
|
||||
assert doc["en"] == """
|
||||
 {: width=24px}
|
||||
 {: width=24px}
|
||||
|
||||
## Examples
|
||||
iex> academic_cap()
|
||||
iex> academic_cap(class: "h-6 w-6 text-gray-500")
|
||||
"""
|
||||
## Examples
|
||||
iex> academic_cap()
|
||||
iex> academic_cap(class: "h-6 w-6 text-gray-500")
|
||||
"""
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user