Skip to content

Commit 6f8df3e

Browse files
committed
Add missing test cases
1 parent a071924 commit 6f8df3e

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

tests/hsx.lisp

+41-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,44 @@
2424
'div
2525
(hsx/builtin:div)
2626
:div)
27-
"div")))))
27+
"div"))))
28+
29+
(testing "empty-hsx"
30+
(let ((elm (div)))
31+
(ok (null (element-props elm)))
32+
(ok (null (element-children elm)))))
33+
34+
(testing "hsx-with-static-props"
35+
(let ((elm (div :prop1 "value1" :prop2 "value2")))
36+
(ok (equal '(:prop1 "value1" :prop2 "value2")
37+
(element-props elm)))
38+
(ok (null (element-children elm)))))
39+
40+
(testing "hsx-with-dynamic-props"
41+
(let* ((props '(:prop1 "value1" :prop2 "value2"))
42+
(elm (div props)))
43+
(ok (equal props (element-props elm)))
44+
(ok (null (element-children elm)))))
45+
46+
(testing "hsx-with-children"
47+
(let ((elm (div
48+
"child1"
49+
"child2")))
50+
(ok (null (element-props elm)))
51+
(ok (equal (list "child1" "child2") (element-children elm)))))
52+
53+
(testing "hsx-with-static-props-and-children"
54+
(let ((elm (div :prop1 "value1" :prop2 "value2"
55+
"child1"
56+
"child2")))
57+
(ok (equal '(:prop1 "value1" :prop2 "value2")
58+
(element-props elm)))
59+
(ok (equal (list "child1" "child2") (element-children elm)))))
60+
61+
(testing "hsx-with-dynamic-props-and-children"
62+
(let* ((props '(:prop1 "value1" :prop2 "value2"))
63+
(elm (div props
64+
"child1"
65+
"child2")))
66+
(ok (equal props (element-props elm)))
67+
(ok (equal (list "child1" "child2") (element-children elm))))))

0 commit comments

Comments
 (0)