2023-12-31 00:24:48 +00:00
|
|
|
let
|
|
|
|
elems = import ../nixite/elems.nix;
|
|
|
|
html = import ../nixite/html.nix;
|
|
|
|
it = import ./it.nix;
|
|
|
|
in
|
|
|
|
with elems; [
|
|
|
|
(it "makes a p tag" {
|
|
|
|
expected = html.tag "p" {} "foobar";
|
2023-12-31 04:27:09 +00:00
|
|
|
actual = p {} "foobar";
|
2023-12-31 00:24:48 +00:00
|
|
|
})
|
2023-12-31 01:14:45 +00:00
|
|
|
(it "makes a div tag" {
|
|
|
|
expected = html.tag "div" {} "foobar";
|
2023-12-31 04:27:09 +00:00
|
|
|
actual = div {} "foobar";
|
2023-12-31 01:14:45 +00:00
|
|
|
})
|
|
|
|
(it "makes a section tag" {
|
|
|
|
expected = html.tag "section" {} "foobar";
|
2023-12-31 04:27:09 +00:00
|
|
|
actual = section {} "foobar";
|
2023-12-31 01:14:45 +00:00
|
|
|
})
|
|
|
|
(it "makes a span tag" {
|
|
|
|
expected = html.tag "span" {} "foobar";
|
2023-12-31 04:27:09 +00:00
|
|
|
actual = span {} "foobar";
|
2023-12-31 01:14:45 +00:00
|
|
|
})
|
2023-12-31 00:24:48 +00:00
|
|
|
(it "makes a main tag" {
|
|
|
|
expected = html.tag "main" {} ["yeet"];
|
2023-12-31 04:27:09 +00:00
|
|
|
actual = main {} ["yeet"];
|
2023-12-31 00:24:48 +00:00
|
|
|
})
|
|
|
|
(it "makes an h1 tag" {
|
|
|
|
expected = html.tag "h1" {} "foobar";
|
|
|
|
actual = h 1 "foobar";
|
|
|
|
})
|
|
|
|
(it "makes an h2 tag" {
|
|
|
|
expected = html.tag "h2" {} "foobar";
|
|
|
|
actual = h 2 "foobar";
|
|
|
|
})
|
|
|
|
(it "makes a title tag" {
|
|
|
|
expected = html.tag "title" {} "foobar";
|
2023-12-31 04:27:09 +00:00
|
|
|
actual = title {} "foobar";
|
2023-12-31 00:24:48 +00:00
|
|
|
})
|
|
|
|
(it "makes an a tag" {
|
|
|
|
expected = html.tag "a" {href = "https://example.com";} "example";
|
|
|
|
actual = link "https://example.com" "example";
|
|
|
|
})
|
|
|
|
(it "makes a stylesheet link" {
|
|
|
|
expected = html.tag "link" {
|
|
|
|
href = "/style";
|
|
|
|
rel = "stylesheet";
|
|
|
|
} "";
|
|
|
|
actual = stylesheet "/style";
|
|
|
|
})
|
|
|
|
(it "makes a list" {
|
2023-12-31 04:27:09 +00:00
|
|
|
expected = toString (html.tag "ul" {} [
|
2023-12-31 00:24:48 +00:00
|
|
|
(html.tag "li" {} "foo")
|
|
|
|
(html.tag "li" {} "bar")
|
|
|
|
(html.tag "li" {} "baz")
|
2023-12-31 04:27:09 +00:00
|
|
|
]);
|
|
|
|
actual = toString (list {} ["foo" "bar" "baz"]);
|
2023-12-31 00:24:48 +00:00
|
|
|
})
|
|
|
|
(it "makes an html doc" {
|
2023-12-31 04:27:09 +00:00
|
|
|
expected = toString (html.tag "html" {
|
|
|
|
__child = "";
|
|
|
|
lang = "en";
|
|
|
|
} [
|
|
|
|
(html.tag "head" {} ["foo"])
|
|
|
|
(html.tag "body" {} "bar")
|
|
|
|
]);
|
|
|
|
actual = toString (doc {} [["foo"] "bar"]);
|
2023-12-31 00:24:48 +00:00
|
|
|
})
|
|
|
|
]
|