summaryrefslogtreecommitdiff
path: root/test/dompa/templates_test.cljc
diff options
context:
space:
mode:
Diffstat (limited to 'test/dompa/templates_test.cljc')
-rw-r--r--test/dompa/templates_test.cljc24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/dompa/templates_test.cljc b/test/dompa/templates_test.cljc
new file mode 100644
index 0000000..6bbaf2c
--- /dev/null
+++ b/test/dompa/templates_test.cljc
@@ -0,0 +1,24 @@
+(ns dompa.templates-test
+ (:require [clojure.test :refer [deftest is testing]]
+ [dompa.templates :refer [defhtml $]]))
+
+(deftest node-composition-test
+ (testing "a simple node"
+ (is (= {:node/name :div
+ :node/children [{:node/name :dompa/text
+ :node/value "hello world"}]}
+ ($ :div ($ "hello world")))))
+
+ (testing "a fragment node"
+ (is (= {:node/name :<>
+ :node/children [{:node/name :span
+ :node/children [{:node/name :dompa/text
+ :node/value "hello"}]}
+ {:node/name :span
+ :node/children [{:node/name :dompa/text
+ :node/value "world"}]}]}
+ ($ :<>
+ ($ :span
+ ($ "hello"))
+ ($ :span
+ ($ "world")))))))