+
Skip to content

add some test and fix html macro #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.nrepl-port
.cpcache
2 changes: 1 addition & 1 deletion src/borkdude/html.clj
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
(str " " (->attrs ?attrs))
"")]
`(str ~(format "<%s%s>" tag attrs)
~@(map #(list 'html %) children)
~@(map #(list `html %) children)
~(format "</%s>" tag)))
(or (string? form)
(number? form)) form
Expand Down
22 changes: 22 additions & 0 deletions test/borkdude/html_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(ns borkdude.html-test
(:require
[borkdude.html :as sut]
[clojure.test :as t]))

(t/deftest ok
(t/are [expected form]
(= expected (sut/html form))

"<div></div>"
[:div]

"<a href=\"#\">Hi</a>"
[:a {:href "#"} "Hi"]

;; XHTML5?
"<hr></hr>"
[:hr]

#_#_
"<div>&lt;script&gt;</div>"
[:div "<script>"]))
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载