-
Notifications
You must be signed in to change notification settings - Fork 174
/
element_test.clj
36 lines (30 loc) · 1.11 KB
/
element_test.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
(ns hiccup.element_test
(:require [clojure.test :refer :all]
[hiccup.element :refer :all])
(:import java.net.URI))
(deftest javascript-tag-test
(is (= (javascript-tag "alert('hello');")
[:script {:type "text/javascript"}
"//<![CDATA[\nalert('hello');\n//]]>"])))
(deftest link-to-test
(is (= (link-to "/")
[:a {:href (URI. "/")} nil]))
(is (= (link-to "/" "foo")
[:a {:href (URI. "/")} (list "foo")]))
(is (= (link-to "/" "foo" "bar")
[:a {:href (URI. "/")} (list "foo" "bar")])))
(deftest mail-to-test
(is (= (mail-to "foo@example.com")
[:a {:href "mailto:foo@example.com"} "foo@example.com"]))
(is (= (mail-to "foo@example.com" "foo")
[:a {:href "mailto:foo@example.com"} (list "foo")])))
(deftest unordered-list-test
(is (= (unordered-list ["foo" "bar" "baz"])
[:ul (list [:li "foo"]
[:li "bar"]
[:li "baz"])])))
(deftest ordered-list-test
(is (= (ordered-list ["foo" "bar" "baz"])
[:ol (list [:li "foo"]
[:li "bar"]
[:li "baz"])])))