summaryrefslogtreecommitdiff
path: root/test/dompa/nodes_test.cljc
diff options
context:
space:
mode:
authorAsko Nõmm <asko@nmm.ee>2026-01-10 14:44:59 +0200
committerAsko Nõmm <asko@nmm.ee>2026-01-10 14:44:59 +0200
commit3e4d870d6b287905c786174565a93fbd79bbb87c (patch)
tree1f10423c01193899e97e9f5afe130fd610aacf03 /test/dompa/nodes_test.cljc
parentbbad09960661f5b7a524301b7b61e8bd33aafce2 (diff)
Add empty-seq? function and update nodes-from-opt to handle empty sequences (#13)
Diffstat (limited to 'test/dompa/nodes_test.cljc')
-rw-r--r--test/dompa/nodes_test.cljc14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/dompa/nodes_test.cljc b/test/dompa/nodes_test.cljc
index 53e502a..b1c7b0f 100644
--- a/test/dompa/nodes_test.cljc
+++ b/test/dompa/nodes_test.cljc
@@ -31,6 +31,20 @@
(is (= "<ul><li>one</li><li>two</li><li>three</li></ul>"
(list-items ["one" "two" "three"]))))
+(defhtml empty-list-items [items]
+ ($ :ul
+ (map (fn [item]
+ ($ :li item))
+ items)))
+
+(deftest empty-list-items-test
+ (testing "map over empty vector should not produce LazySeq string"
+ (is (= "<ul></ul>"
+ (empty-list-items []))))
+ (testing "map over non-empty vector should work"
+ (is (= "<ul><li>one</li><li>two</li></ul>"
+ (empty-list-items ["one" "two"])))))
+
(deftest $-test
(testing "a simple node"
(is (= {:node/name :div