2023-12-31 00:24:48 +00:00
|
|
|
let
|
|
|
|
html = import ../nixite/html.nix;
|
|
|
|
it = import ./it.nix;
|
2023-12-31 21:33:42 +00:00
|
|
|
in with html; [
|
|
|
|
(it "makes a p tag" {
|
|
|
|
actual = tag "p" { } "Hello";
|
|
|
|
expected = {
|
|
|
|
tag = "p";
|
|
|
|
attrs = { };
|
|
|
|
child = "Hello";
|
|
|
|
__toString = toHTML;
|
|
|
|
};
|
|
|
|
})
|
2023-12-31 00:24:48 +00:00
|
|
|
|
2023-12-31 21:33:42 +00:00
|
|
|
(it "concatinates classes" {
|
|
|
|
actual = toString (tag "p" { class = [ "class1" "class2" ]; } "Hello");
|
|
|
|
expected = ''<p class="class1 class2">Hello</p>'';
|
|
|
|
})
|
2023-12-31 03:08:05 +00:00
|
|
|
|
2023-12-31 21:33:42 +00:00
|
|
|
(it "applies style" (let page = tag "html" { } [ (tag "head" { } [ "foo" ]) ];
|
|
|
|
in {
|
|
|
|
actual = addToHead page [ "bar" ];
|
|
|
|
expected = {
|
|
|
|
tag = "html";
|
|
|
|
attrs = { };
|
|
|
|
child = [ (tag "head" { } [ "foo" "bar" ]) ];
|
|
|
|
__toString = toHTML;
|
|
|
|
};
|
|
|
|
}))
|
|
|
|
]
|