From 40a5c7c7b3b28158a6969464bed4c5552d336394 Mon Sep 17 00:00:00 2001 From: Kamaro Date: Mon, 24 Jun 2024 21:25:39 +0300 Subject: [PATCH 1/2] Added label tests --- test/salad_ui/dialog_test.exs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/salad_ui/dialog_test.exs b/test/salad_ui/dialog_test.exs index dd67711..e8d418f 100644 --- a/test/salad_ui/dialog_test.exs +++ b/test/salad_ui/dialog_test.exs @@ -11,11 +11,14 @@ defmodule SaladUI.DialogTest do assigns = %{} html = - rendered_to_string(~H""" + ~H""" <.dialog_header>This is the content of the header - """) + """ + |> rendered_to_string() + |> clean_string() - assert html =~ "This is the content of the header\n" + assert html =~ + "
This is the content of the header
" for css_class <- ~w(flex flex-col space-y-1.5 text-center sm:text-left) do assert html =~ css_class From e5c419196ada246b929c4fab4d2324376a4146e3 Mon Sep 17 00:00:00 2001 From: Kamaro Date: Mon, 24 Jun 2024 21:27:18 +0300 Subject: [PATCH 2/2] Added the missing label tests --- test/salad_ui/label_test.exs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/salad_ui/label_test.exs diff --git a/test/salad_ui/label_test.exs b/test/salad_ui/label_test.exs new file mode 100644 index 0000000..ec95692 --- /dev/null +++ b/test/salad_ui/label_test.exs @@ -0,0 +1,21 @@ +defmodule SaladUI.LabelTest do + use ComponentCase + + import SaladUI.Label + + describe "Test Label" do + test "It should render label correctly" do + assigns = %{} + + html = + ~H""" + <.label class="text-green-500">Send! + """ + |> rendered_to_string() + |> clean_string() + + assert html =~ + "" + end + end +end