From ba9005587b045d417b460f59145032f569c95cba Mon Sep 17 00:00:00 2001 From: Asko Nõmm Date: Wed, 11 Feb 2026 01:53:02 +0200 Subject: Allow docstrings in `defhtml` (closes #2) --- test/dompa/nodes_test.cljc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') 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 (= "
hello world
" (hello "world")))) +(deftest defhtml-docstring-test + (testing "defhtml with docstring produces correct HTML" + (is (= "
hello world
" + (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 -- cgit v1.2.3