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";
actual = p { } "foobar";
asString = true;
})
(it "makes a div tag" {
expected = html.tag "div" { } "foobar";
actual = div { } "foobar";
asString = true;
})
(it "makes a section tag" {
expected = html.tag "section" { } "foobar";
actual = section { } "foobar";
asString = true;
})
(it "makes a span tag" {
expected = html.tag "span" { } "foobar";
actual = span { } "foobar";
asString = true;
})
(it "makes a main tag" {
expected = html.tag "main" { } [ "yeet" ];
actual = main { } [ "yeet" ];
asString = true;
})
(it "makes an h1 tag" {
expected = html.tag "h1" { } "foobar";
actual = H 1 "foobar";
asString = true;
})
(it "makes an h2 tag" {
expected = html.tag "h2" { } "foobar";
actual = H 2 "foobar";
asString = true;
})
(it "makes a title tag" {
expected = html.tag "title" { } "foobar";
actual = title { } "foobar";
asString = true;
})
(it "makes an a tag" {
expected = html.tag "a" {
class = [ "a" ];
href = "https://example.com";
} "example";
actual = a "https://example.com" "example";
asString = true;
})
(it "makes a stylesheet link" {
expected = html.tag "link" {
href = "/style";
rel = "stylesheet";
} "";
actual = Stylesheet { href = "/style"; };
asString = true;
})
(it "makes a list" {
expected = html.tag "ul" {
__ = "";
class = [ "List" ];
} [
(html.tag "li" { } "foo")
(html.tag "li" { } "bar")
(html.tag "li" { } "baz")
];
actual = List { } [ "foo" "bar" "baz" ];
asString = true;
})
(it "makes an html doc" {
expected = html.tag "html" {
__child = "";
class = [ ];
lang = "en";
} [ (html.tag "head" { } [ "foo" ]) (html.tag "body" { } "bar") ];
actual = Doc { } [ [ "foo" ] "bar" ];
asString = true;
})
]