44 lines
939 B
Nix
44 lines
939 B
Nix
let
|
|
html = import ../nixite/html.nix;
|
|
it = import ./it.nix;
|
|
in with html; [
|
|
|
|
(it "keeps info in the tag" (let p = tag "p";
|
|
in {
|
|
actual = p.tag;
|
|
expected = "p";
|
|
}))
|
|
|
|
(it "keeps attr info in the tag" (let p = tag "p" { class = ""; };
|
|
in {
|
|
actual = p.attrs;
|
|
expected = { class = ""; };
|
|
}))
|
|
|
|
(it "makes a p tag" {
|
|
actual = tag "p" { } "Hello";
|
|
expected = {
|
|
tag = "p";
|
|
attrs = { };
|
|
child = "Hello";
|
|
__toString = toHTML;
|
|
};
|
|
})
|
|
|
|
(it "concatinates classes" {
|
|
actual = toString (tag "p" { class = [ "class1" "class2" ]; } "Hello");
|
|
expected = ''<p class="class1 class2">Hello</p>'';
|
|
})
|
|
|
|
(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;
|
|
};
|
|
}))
|
|
]
|