From c0d0f5d38a2a751a18dfa6106dda89c3ff9bb732 Mon Sep 17 00:00:00 2001 From: Max Veytsman Date: Fri, 2 Sep 2022 13:21:32 -0400 Subject: [PATCH] Fix tests/docs --- lib/heroicons/generator.ex | 5 +++++ test/heroicons_test.exs | 35 ++++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/lib/heroicons/generator.ex b/lib/heroicons/generator.ex index 8b3fdf8..4b67e98 100644 --- a/lib/heroicons/generator.ex +++ b/lib/heroicons/generator.ex @@ -43,11 +43,16 @@ defmodule Heroicons.Generator do """ ![](assets/#{Path.relative_to(path, :code.priv_dir(:heroicons))}) {: width=24px} + ## Examples + Use as a `Phoenix.Component` + <.#{name} /> <.#{name} class="h-6 w-6 text-gray-500" /> + or as a function + <%= #{name}() %> <%= #{name}(class: "h-6 w-6 text-gray-500") %> """ diff --git a/test/heroicons_test.exs b/test/heroicons_test.exs index ab09c9b..59832c5 100644 --- a/test/heroicons_test.exs +++ b/test/heroicons_test.exs @@ -4,9 +4,13 @@ defmodule HeroiconsTest do import Phoenix.LiveViewTest test "generated function" do - assert Heroicons.Outline.academic_cap() - |> Phoenix.HTML.safe_to_string() =~ - ~s( Phoenix.HTML.safe_to_string() =~ @@ -30,11 +34,19 @@ defmodule HeroiconsTest do end test "generated components" do - assert render_component(&Heroicons.Outline.academic_cap/1, assigns()) =~ - ~s( - <.academic_cap class="h-6 w-6 text-gray-500" /> or as a function <%= academic_cap() %> - <%= academic_cap(class: "h-6 w-6 text-gray-500") %> """ end