-
Notifications
You must be signed in to change notification settings - Fork 103
/
Copy pathloading_test.exs
53 lines (40 loc) · 951 Bytes
/
loading_test.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
defmodule PetalComponents.LoadingTest do
use ComponentCase
import PetalComponents.Loading
test "spinner" do
assigns = %{}
html =
rendered_to_string(~H"""
<.spinner show={true} />
""")
assert html =~ "<svg"
refute html =~ "hidden"
html =
rendered_to_string(~H"""
<.spinner show={true} size="sm" />
""")
assert html =~ "pc-spinner--sm"
html =
rendered_to_string(~H"""
<.spinner show={true} class="some_class" />
""")
assert html =~ "some_class"
end
test "spinner defaults to visible" do
assigns = %{}
html =
rendered_to_string(~H"""
<.spinner />
""")
assert html =~ "<svg"
refute html =~ "hidden"
end
test "should include additional assigns" do
assigns = %{}
html =
rendered_to_string(~H"""
<.spinner custom-attrs="123" />
""")
assert html =~ ~s{custom-attrs="123"}
end
end