summaryrefslogtreecommitdiff
path: root/test/dompa
diff options
context:
space:
mode:
authorAsko Nõmm <asko@apesrc.com>2026-02-11 01:53:02 +0200
committerAsko Nõmm <asko@apesrc.com>2026-02-11 01:53:02 +0200
commitba9005587b045d417b460f59145032f569c95cba (patch)
treec1a1d97710f896d519ed5679353c4955251604a5 /test/dompa
parentd23410f547608deae53ed8e028b46f8572552ef3 (diff)
Allow docstrings in `defhtml` (closes #2)allow-docstrings-in-defhtml
Diffstat (limited to 'test/dompa')
-rw-r--r--test/dompa/nodes_test.cljc18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/dompa/nodes_test.cljc b/test/dompa/nodes_test.cljc
index 0340abb..e7c6616 100644
--- a/test/dompa/nodes_test.cljc
+++ b/test/dompa/nodes_test.cljc
@@ -16,10 +16,28 @@
($ :div
($ "hello " who)))
+(defhtml hello-with-doc
+ "Greets the given person with a div."
+ [who]
+ ($ :div
+ ($ "hello " who)))
+
(deftest defhtml-test
(is (= "<div>hello world</div>"
(hello "world"))))
+(deftest defhtml-docstring-test
+ (testing "defhtml with docstring produces correct HTML"
+ (is (= "<div>hello world</div>"
+ (hello-with-doc "world"))))
+ #?(:clj
+ (testing "docstring is attached to the var metadata"
+ (is (= "Greets the given person with a div."
+ (:doc (meta #'hello-with-doc))))))
+ #?(:clj
+ (testing "defhtml without docstring has no :doc metadata"
+ (is (nil? (:doc (meta #'hello)))))))
+
(defhtml list-items [items]
($ :ul
(->> items