Skip to content

Commit

Permalink
Merge pull request #20 from kamaroly/label_test
Browse files Browse the repository at this point in the history
Added label tests
  • Loading branch information
bluzky authored Jun 25, 2024
2 parents 5042a39 + e5c4191 commit 96e947a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/salad_ui/dialog_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,14 @@ defmodule SaladUI.DialogTest do
assigns = %{}

html =
rendered_to_string(~H"""
~H"""
<.dialog_header>This is the content of the header</.dialog_header>
""")
"""
|> rendered_to_string()
|> clean_string()

assert html =~ "This is the content of the header\n</div>"
assert html =~
"<div class=\"flex text-center flex-col space-y-1.5 sm:text-left\">This is the content of the header</div>"

for css_class <- ~w(flex flex-col space-y-1.5 text-center sm:text-left) do
assert html =~ css_class
Expand Down
21 changes: 21 additions & 0 deletions test/salad_ui/label_test.exs
Original file line number Diff line number Diff line change
@@ -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!</.label>
"""
|> rendered_to_string()
|> clean_string()

assert html =~
"<label class=\"text-green-500 font-medium leading-none text-sm peer-disabled:cursor-not-allowed peer-disabled:opacity-70\">Send!</label>"
end
end
end

0 comments on commit 96e947a

Please sign in to comment.