2024-01-03 07:52:35 +00:00
|
|
|
{
|
|
|
|
describe,
|
|
|
|
it,
|
|
|
|
...
|
|
|
|
}: let
|
2023-12-31 00:24:48 +00:00
|
|
|
elems = import ../nixite/elems.nix;
|
|
|
|
html = import ../nixite/html.nix;
|
2024-01-02 10:53:45 +00:00
|
|
|
in
|
2024-01-03 13:19:41 +00:00
|
|
|
with elems; [
|
|
|
|
(
|
|
|
|
describe "html tag" [
|
|
|
|
(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 a title tag" {
|
|
|
|
expected = html.tag "title" {} "foobar";
|
|
|
|
actual = title {} "foobar";
|
|
|
|
asString = true;
|
|
|
|
})
|
2024-01-01 13:48:26 +00:00
|
|
|
|
2024-01-03 13:19:41 +00:00
|
|
|
(it "makes an a tag" {
|
|
|
|
expected = html.tag "a" {href = "https://example.com";} "example";
|
|
|
|
actual = a {href = "https://example.com";} "example";
|
|
|
|
asString = true;
|
|
|
|
})
|
2024-01-01 13:48:26 +00:00
|
|
|
|
2024-01-03 13:19:41 +00:00
|
|
|
(it "lets the a tag drop the props" {
|
|
|
|
expected = html.tag "a" {href = "https://example.com";} "example";
|
|
|
|
actual = a "https://example.com" "example";
|
|
|
|
asString = true;
|
|
|
|
})
|
2024-01-01 13:48:26 +00:00
|
|
|
|
2024-01-03 13:19:41 +00:00
|
|
|
(it "lets you extend the a tag" (let
|
|
|
|
extA = a {class = ["linky"];};
|
|
|
|
in {
|
|
|
|
expected = ["linky"];
|
|
|
|
actual =
|
|
|
|
(extA "https://example.com" "example")
|
|
|
|
.attrs
|
|
|
|
.class;
|
|
|
|
asString = true;
|
|
|
|
}))
|
2024-01-01 13:48:26 +00:00
|
|
|
|
2024-01-03 13:19:41 +00:00
|
|
|
(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" {__ = "";} [
|
|
|
|
(html.tag "li" {} "foo")
|
|
|
|
(html.tag "li" {} "bar")
|
|
|
|
(html.tag "li" {} "baz")
|
|
|
|
];
|
|
|
|
actual = List {} ["foo" "bar" "baz"];
|
|
|
|
asString = true;
|
|
|
|
})
|
|
|
|
]
|
|
|
|
)
|
|
|
|
]
|