Skip to content

Commit

Permalink
Add xml test
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jun 1, 2024
1 parent 1405c23 commit a47df56
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/borkdude/html.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@
(if (string? attrs)
[(str "<" tag attrs ">")]
["<" tag " " attrs ">"]))
~@(map #(list `html %) children)
~@(map #(list (if xml?
`xml
`html) %) children)
~(if (or omit-tag?
(and (contains? void-tags tag)
(not xml?)))
Expand Down
7 changes: 5 additions & 2 deletions test/borkdude/html_test.cljc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns borkdude.html-test
(:require
[borkdude.html :refer [html]]
[borkdude.html :refer [html xml]]
[clojure.test :as t]))

(defn child-component [{:keys [name]}]
Expand Down Expand Up @@ -60,7 +60,10 @@
[2 3])])

"<div><br></div>"
(html [:div [:br]]))
(html [:div [:br]])

"<div><br></br></div>"
(xml [:div [:br]]))
)

(comment
Expand Down

0 comments on commit a47df56

Please sign in to comment.