alejandra
This commit is contained in:
parent
b1426fb1ca
commit
dc33fdf093
14 changed files with 1029 additions and 976 deletions
|
@ -1,83 +1,86 @@
|
|||
{ it, ... }:
|
||||
let
|
||||
{it, ...}: let
|
||||
elems = import ../nixite/elems.nix;
|
||||
style = import ../nixite/style.nix;
|
||||
html = import ../nixite/html.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 a title tag" {
|
||||
expected = html.tag "title" { } "foobar";
|
||||
actual = title { } "foobar";
|
||||
asString = true;
|
||||
})
|
||||
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 a title tag" {
|
||||
expected = html.tag "title" {} "foobar";
|
||||
actual = title {} "foobar";
|
||||
asString = true;
|
||||
})
|
||||
|
||||
(it "makes an a tag" {
|
||||
expected = html.tag "a" { href = "https://example.com"; } "example";
|
||||
actual = a { href = "https://example.com"; } "example";
|
||||
asString = true;
|
||||
})
|
||||
(it "makes an a tag" {
|
||||
expected = html.tag "a" {href = "https://example.com";} "example";
|
||||
actual = a {href = "https://example.com";} "example";
|
||||
asString = true;
|
||||
})
|
||||
|
||||
(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;
|
||||
})
|
||||
(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;
|
||||
})
|
||||
|
||||
(it "lets you extend the a tag" {
|
||||
expected = [ "linky" ];
|
||||
actual = ((style.component a "linky" { }) "https://example.com"
|
||||
"example").attrs.class;
|
||||
asString = true;
|
||||
})
|
||||
(it "lets you extend the a tag" {
|
||||
expected = ["linky"];
|
||||
actual =
|
||||
((style.component a "linky" {}) "https://example.com"
|
||||
"example")
|
||||
.attrs
|
||||
.class;
|
||||
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" { __ = ""; } [
|
||||
(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;
|
||||
})
|
||||
]
|
||||
(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;
|
||||
})
|
||||
(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;
|
||||
})
|
||||
]
|
||||
|
|
|
@ -1,142 +1,149 @@
|
|||
{ it, ... }:
|
||||
let html = import ../nixite/html.nix;
|
||||
in with html; [
|
||||
{it, ...}: let
|
||||
html = import ../nixite/html.nix;
|
||||
in
|
||||
with html; [
|
||||
(it "keeps info in the tag" (let
|
||||
p = tag "p";
|
||||
in {
|
||||
actual = p.tag;
|
||||
expected = "p";
|
||||
}))
|
||||
|
||||
(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 "keeps attr info in the tag" (let p = tag "p" { class = ""; };
|
||||
in {
|
||||
actual = p.attrs;
|
||||
expected = { class = ""; };
|
||||
}))
|
||||
(it "keeps tag after setting attrs" (let
|
||||
p = tag "p" {class = "";};
|
||||
in {
|
||||
actual = p.tag;
|
||||
expected = "p";
|
||||
}))
|
||||
|
||||
(it "keeps tag after setting attrs" (let p = tag "p" { class = ""; };
|
||||
in {
|
||||
actual = p.tag;
|
||||
expected = "p";
|
||||
}))
|
||||
(it "makes a p tag" {
|
||||
actual = tag "p" {} "Hello";
|
||||
expected = {
|
||||
tag = "p";
|
||||
attrs = {};
|
||||
child = "Hello";
|
||||
};
|
||||
removeDunders = true;
|
||||
})
|
||||
|
||||
(it "makes a p tag" {
|
||||
actual = tag "p" { } "Hello";
|
||||
expected = {
|
||||
tag = "p";
|
||||
attrs = { };
|
||||
child = "Hello";
|
||||
};
|
||||
removeDunders = true;
|
||||
})
|
||||
(it "makes element" (let
|
||||
para = tag "p" {};
|
||||
in {
|
||||
expected = "p";
|
||||
actual = para.tag;
|
||||
}))
|
||||
|
||||
(it "makes element" (let para = (tag "p" { });
|
||||
in {
|
||||
expected = "p";
|
||||
actual = para.tag;
|
||||
}))
|
||||
(it "keeps attrs on element" (let
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = tag "p" attrs;
|
||||
in {
|
||||
expected = attrs;
|
||||
actual = para.attrs;
|
||||
}))
|
||||
|
||||
(it "keeps attrs on element" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (tag "p" attrs);
|
||||
in {
|
||||
expected = attrs;
|
||||
actual = para.attrs;
|
||||
}))
|
||||
(it "makes renderable element" (let
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = tag "p" attrs;
|
||||
in {
|
||||
expected = "<p ></p>";
|
||||
actual = toString (para "");
|
||||
}))
|
||||
|
||||
(it "makes renderable element" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (tag "p" attrs);
|
||||
in {
|
||||
expected = "<p ></p>";
|
||||
actual = toString (para "");
|
||||
}))
|
||||
(it "keeps tag" (let
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = tag "p" attrs;
|
||||
in {
|
||||
expected = "p";
|
||||
actual = (para "").tag;
|
||||
}))
|
||||
|
||||
(it "keeps tag" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (tag "p" attrs);
|
||||
in {
|
||||
expected = "p";
|
||||
actual = (para "").tag;
|
||||
}))
|
||||
(it "keeps style" (let
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = tag "p" attrs;
|
||||
in {
|
||||
expected = {foo = "bar";};
|
||||
actual = (para "").attrs.style;
|
||||
}))
|
||||
|
||||
(it "keeps style" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (tag "p" attrs);
|
||||
in {
|
||||
expected = { foo = "bar"; };
|
||||
actual = (para "").attrs.style;
|
||||
}))
|
||||
(it "needs no args to make string" (let
|
||||
p = tag "p";
|
||||
in {
|
||||
actual = toString p;
|
||||
expected = "<p ></p>";
|
||||
}))
|
||||
|
||||
(it "needs no args to make string" (let p = tag "p";
|
||||
in {
|
||||
actual = toString p;
|
||||
expected = "<p ></p>";
|
||||
}))
|
||||
(it "needs no content to make string" (let
|
||||
p = tag "p";
|
||||
in {
|
||||
actual = toString (p {class = "foobar";});
|
||||
expected = ''<p class="foobar"></p>'';
|
||||
}))
|
||||
|
||||
(it "needs no content to make string" (let p = tag "p";
|
||||
in {
|
||||
actual = toString (p { class = "foobar"; });
|
||||
expected = ''<p class="foobar"></p>'';
|
||||
}))
|
||||
(it "can take many sets of props" (let
|
||||
p = tag "p";
|
||||
in {
|
||||
actual = toString (p {class = "foobar";} {style = "a style";});
|
||||
expected = ''<p class="foobar" style="a style"></p>'';
|
||||
}))
|
||||
|
||||
(it "can take many sets of props" (let p = tag "p";
|
||||
in {
|
||||
actual = toString (p { class = "foobar"; } { style = "a style"; });
|
||||
expected = ''<p class="foobar" style="a style"></p>'';
|
||||
}))
|
||||
(it "works recursively" (let
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = tag "p" attrs;
|
||||
a = tag "a" {};
|
||||
in {
|
||||
expected = "<p ><a >hello</a></p>";
|
||||
actual = toString (para (a "hello"));
|
||||
}))
|
||||
|
||||
(it "works recursively" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (tag "p" attrs);
|
||||
a = (tag "a" { });
|
||||
in {
|
||||
expected = "<p ><a >hello</a></p>";
|
||||
actual = toString (para (a "hello"));
|
||||
}))
|
||||
(it "throws with function child" {
|
||||
actual = toString (tag "p" (i: ""));
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "throws with function child" ({
|
||||
actual = toString (tag "p" (i: ""));
|
||||
throws = true;
|
||||
}))
|
||||
(it "throws with a number" {
|
||||
actual = toString (tag "p" 5);
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "throws with a number" ({
|
||||
actual = toString (tag "p" 5);
|
||||
throws = true;
|
||||
}))
|
||||
(it "throws with a bool" {
|
||||
actual = toString (tag "p" true);
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "throws with a bool" ({
|
||||
actual = toString (tag "p" true);
|
||||
throws = true;
|
||||
}))
|
||||
(it "throws with a null" {
|
||||
actual = toString (tag "p" null);
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "throws with a null" ({
|
||||
actual = toString (tag "p" null);
|
||||
throws = true;
|
||||
}))
|
||||
(it "concatinates classes" {
|
||||
actual = toString (tag "p" {class = ["class1" "class2"];} "Hello");
|
||||
expected = ''<p class="class1 class2">Hello</p>'';
|
||||
})
|
||||
|
||||
(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"])];
|
||||
};
|
||||
removeDunders = true;
|
||||
}))
|
||||
|
||||
(it "applies style" (let page = tag "html" { } [ (tag "head" { } [ "foo" ]) ];
|
||||
in {
|
||||
actual = addToHead page [ "bar" ];
|
||||
expected = {
|
||||
tag = "html";
|
||||
attrs = { };
|
||||
child = [ (tag "head" { } [ "foo" "bar" ]) ];
|
||||
};
|
||||
removeDunders = true;
|
||||
}))
|
||||
|
||||
(it "renders on / off attrs" ({
|
||||
actual = toString (tag "p" {
|
||||
on = true;
|
||||
off = false;
|
||||
});
|
||||
expected = "<p on></p>";
|
||||
}))
|
||||
|
||||
]
|
||||
(it "renders on / off attrs" {
|
||||
actual = toString (tag "p" {
|
||||
on = true;
|
||||
off = false;
|
||||
});
|
||||
expected = "<p on></p>";
|
||||
})
|
||||
]
|
||||
|
|
|
@ -1,148 +1,148 @@
|
|||
{ it, ... }:
|
||||
let
|
||||
{it, ...}: let
|
||||
md = import ../nixite/md.nix;
|
||||
elems = import ../nixite/elems.nix;
|
||||
in with md; [
|
||||
in
|
||||
with md; [
|
||||
(it "matches a list of one element" {
|
||||
actual = list ''
|
||||
- something
|
||||
'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List ["something"];
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "matches a list of one element" ({
|
||||
actual = list ''
|
||||
- something
|
||||
'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List [ "something" ];
|
||||
};
|
||||
asJSON = true;
|
||||
}))
|
||||
(it "makes a list of many elements" {
|
||||
actual = list ''
|
||||
- something
|
||||
- something else
|
||||
'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List ["something" "something else"];
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "makes a list of many elements" ({
|
||||
actual = list ''
|
||||
- something
|
||||
- something else
|
||||
'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List [ "something" "something else" ];
|
||||
};
|
||||
asJSON = true;
|
||||
}))
|
||||
(it "makes a list of many checkboxes" {
|
||||
actual = list ''
|
||||
- [ ] something
|
||||
- [X] something else
|
||||
'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List [
|
||||
[
|
||||
(elems.input {
|
||||
type = "checkbox";
|
||||
disabled = true;
|
||||
checked = false;
|
||||
} "")
|
||||
"something"
|
||||
]
|
||||
[
|
||||
(elems.input {
|
||||
type = "checkbox";
|
||||
disabled = true;
|
||||
checked = true;
|
||||
} "")
|
||||
"something else"
|
||||
]
|
||||
];
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "makes a list of many checkboxes" ({
|
||||
actual = list ''
|
||||
- [ ] something
|
||||
- [X] something else
|
||||
'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List [
|
||||
[
|
||||
(elems.input {
|
||||
type = "checkbox";
|
||||
disabled = true;
|
||||
checked = false;
|
||||
} "")
|
||||
"something"
|
||||
]
|
||||
[
|
||||
(elems.input {
|
||||
type = "checkbox";
|
||||
disabled = true;
|
||||
checked = true;
|
||||
} "")
|
||||
"something else"
|
||||
]
|
||||
(it "matches a list with no whitespace around" {
|
||||
actual = list ''
|
||||
- something
|
||||
- something else'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List ["something" "something else"];
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "doesnt match not a list" (let
|
||||
str = "blah blah";
|
||||
in {
|
||||
actual = list str;
|
||||
expected = {
|
||||
matched = false;
|
||||
block = str;
|
||||
};
|
||||
}))
|
||||
|
||||
(it "processes whole string with all rules" {
|
||||
actual = processStr ''
|
||||
this text **may** *or may not* contain **bold** words *inside* it.
|
||||
'';
|
||||
expected = elems.p [
|
||||
"this text"
|
||||
(elems.strong "may")
|
||||
(elems.em "or may not")
|
||||
"contain"
|
||||
(elems.strong "bold")
|
||||
"words"
|
||||
(elems.em "inside")
|
||||
"it."
|
||||
];
|
||||
};
|
||||
asJSON = true;
|
||||
}))
|
||||
asString = true;
|
||||
})
|
||||
|
||||
(it "matches a list with no whitespace around" ({
|
||||
actual = list ''
|
||||
- something
|
||||
- something else'';
|
||||
expected = {
|
||||
matched = true;
|
||||
block = elems.List [ "something" "something else" ];
|
||||
};
|
||||
asJSON = true;
|
||||
}))
|
||||
(it "makes paragraphs" {
|
||||
actual = readMd ''
|
||||
lorem ipsum
|
||||
dolor sit
|
||||
|
||||
(it "doesnt match not a list" (let str = "blah blah";
|
||||
in {
|
||||
actual = list str;
|
||||
expected = {
|
||||
matched = false;
|
||||
block = str;
|
||||
};
|
||||
}))
|
||||
foo bar
|
||||
'';
|
||||
expected = ''
|
||||
<p >lorem ipsum
|
||||
dolor sit
|
||||
</p><p >foo bar</p>'';
|
||||
asString = true;
|
||||
})
|
||||
|
||||
(it "processes whole string with all rules" ({
|
||||
actual = processStr ''
|
||||
this text **may** *or may not* contain **bold** words *inside* it.
|
||||
'';
|
||||
expected = (elems.p [
|
||||
"this text"
|
||||
(elems.strong "may")
|
||||
(elems.em "or may not")
|
||||
"contain"
|
||||
(elems.strong "bold")
|
||||
"words"
|
||||
(elems.em "inside")
|
||||
"it."
|
||||
]);
|
||||
asString = true;
|
||||
}))
|
||||
(it "can fix file appendixes" {
|
||||
actual = fixAppendix "index.md";
|
||||
expected = "index.html";
|
||||
})
|
||||
|
||||
(it "makes paragraphs" {
|
||||
actual = readMd ''
|
||||
lorem ipsum
|
||||
dolor sit
|
||||
(it "converts markdown to a page" {
|
||||
actual = toString (mdToPage ./blog/index.md) + "\n";
|
||||
expected = builtins.readFile ./out/index.html;
|
||||
asString = true;
|
||||
})
|
||||
|
||||
foo bar
|
||||
'';
|
||||
expected = ''
|
||||
<p >lorem ipsum
|
||||
dolor sit
|
||||
</p><p >foo bar</p>'';
|
||||
asString = true;
|
||||
})
|
||||
(it "recursively reads dir" {
|
||||
actual = recReadMd ./blog;
|
||||
expected = {
|
||||
"index.md" = mdToPage ./blog/index.md;
|
||||
"dir" = {"index.md" = mdToPage ./blog/dir/index.md;};
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "can fix file appendixes" {
|
||||
actual = fixAppendix "index.md";
|
||||
expected = "index.html";
|
||||
})
|
||||
(it "recursively fixes filename" {
|
||||
actual = recFixAppendix {
|
||||
"index.md" = "something";
|
||||
dir = {"index.md" = "something else";};
|
||||
};
|
||||
expected = {
|
||||
"index.html" = "something";
|
||||
dir = {"index.html" = "something else";};
|
||||
};
|
||||
})
|
||||
|
||||
(it "converts markdown to a page" {
|
||||
actual = toString (mdToPage ./blog/index.md) + "\n";
|
||||
expected = builtins.readFile ./out/index.html;
|
||||
asString = true;
|
||||
})
|
||||
|
||||
(it "recursively reads dir" {
|
||||
actual = recReadMd ./blog;
|
||||
expected = {
|
||||
"index.md" = mdToPage ./blog/index.md;
|
||||
"dir" = { "index.md" = mdToPage ./blog/dir/index.md; };
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "recursively fixes filename" {
|
||||
actual = recFixAppendix {
|
||||
"index.md" = "something";
|
||||
dir = { "index.md" = "something else"; };
|
||||
};
|
||||
expected = {
|
||||
"index.html" = "something";
|
||||
dir = { "index.html" = "something else"; };
|
||||
};
|
||||
})
|
||||
|
||||
(it "recursively translates md to html" {
|
||||
actual = builtins.toJSON (readDir ./blog);
|
||||
expected = builtins.toJSON {
|
||||
"index.html" = mdToPage ./blog/index.md;
|
||||
"dir" = { "index.html" = mdToPage ./blog/dir/index.md; };
|
||||
};
|
||||
})
|
||||
]
|
||||
(it "recursively translates md to html" {
|
||||
actual = builtins.toJSON (readDir ./blog);
|
||||
expected = builtins.toJSON {
|
||||
"index.html" = mdToPage ./blog/index.md;
|
||||
"dir" = {"index.html" = mdToPage ./blog/dir/index.md;};
|
||||
};
|
||||
})
|
||||
]
|
||||
|
|
|
@ -1,315 +1,313 @@
|
|||
{ it, ... }:
|
||||
let
|
||||
{it, ...}: let
|
||||
html = import ../nixite/html.nix;
|
||||
elems = import ../nixite/elems.nix;
|
||||
site = import ../nixite/site.nix;
|
||||
style = import ../nixite/style.nix;
|
||||
in with site; [
|
||||
(it "applies a style" {
|
||||
expected = {
|
||||
"index.html" = html.tag "html" { } [
|
||||
(html.tag "head" { } [
|
||||
(elems.title { } "foobar")
|
||||
(elems.Stylesheet "/style.css")
|
||||
])
|
||||
(elems.main { } "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = html.tag "html" { } [
|
||||
(html.tag "head" { } [
|
||||
(elems.title { } "foobar")
|
||||
in
|
||||
with site; [
|
||||
(it "applies a style" {
|
||||
expected = {
|
||||
"index.html" = html.tag "html" {} [
|
||||
(html.tag "head" {} [
|
||||
(elems.title {} "foobar")
|
||||
(elems.Stylesheet "/style.css")
|
||||
])
|
||||
(elems.main { } "blogy blog")
|
||||
(elems.main {} "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = html.tag "html" {} [
|
||||
(html.tag "head" {} [
|
||||
(elems.title {} "foobar")
|
||||
(elems.Stylesheet "/style.css")
|
||||
])
|
||||
(elems.main {} "blogy blog")
|
||||
];
|
||||
};
|
||||
"style.css" = ''
|
||||
this is a stylesheet
|
||||
'';
|
||||
};
|
||||
"style.css" = ''
|
||||
this is a stylesheet
|
||||
'';
|
||||
};
|
||||
actual = applyStyle ''
|
||||
this is a stylesheet
|
||||
'' {
|
||||
"index.html" = html.tag "html" { } [
|
||||
(html.tag "head" { } [ (elems.title { } "foobar") ])
|
||||
(elems.main { } "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = html.tag "html" { } [
|
||||
(html.tag "head" { } [ (elems.title { } "foobar") ])
|
||||
(elems.main { } "blogy blog")
|
||||
];
|
||||
};
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
actual =
|
||||
applyStyle ''
|
||||
this is a stylesheet
|
||||
'' {
|
||||
"index.html" = html.tag "html" {} [
|
||||
(html.tag "head" {} [(elems.title {} "foobar")])
|
||||
(elems.main {} "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = html.tag "html" {} [
|
||||
(html.tag "head" {} [(elems.title {} "foobar")])
|
||||
(elems.main {} "blogy blog")
|
||||
];
|
||||
};
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "applies a favicon" {
|
||||
expected = {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [
|
||||
(elems.title { } "foobar")
|
||||
(elems.link {
|
||||
rel = "shortcut icon";
|
||||
href = ./src/favicon.png;
|
||||
})
|
||||
])
|
||||
(elems.main { } "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [
|
||||
(elems.title { } "foobar")
|
||||
(it "applies a favicon" {
|
||||
expected = {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [
|
||||
(elems.title {} "foobar")
|
||||
(elems.link {
|
||||
rel = "shortcut icon";
|
||||
href = ./src/favicon.png;
|
||||
})
|
||||
])
|
||||
(elems.main { } "something")
|
||||
(elems.main {} "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [
|
||||
(elems.title {} "foobar")
|
||||
(elems.link {
|
||||
rel = "shortcut icon";
|
||||
href = ./src/favicon.png;
|
||||
})
|
||||
])
|
||||
(elems.main {} "something")
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
actual = applyFavicon ./src/favicon.png {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [ (elems.title { } "foobar") ])
|
||||
(elems.main { } "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [ (elems.title { } "foobar") ])
|
||||
(elems.main { } "something")
|
||||
actual = applyFavicon ./src/favicon.png {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [(elems.title {} "foobar")])
|
||||
(elems.main {} "something")
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [(elems.title {} "foobar")])
|
||||
(elems.main {} "something")
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
asJSON = true;
|
||||
})
|
||||
asJSON = true;
|
||||
})
|
||||
|
||||
(it "gets all styles" {
|
||||
expected = {
|
||||
"p" = { };
|
||||
"div" = { };
|
||||
"p.class" = { color = "blue"; };
|
||||
"div.class2" = { color = "green"; };
|
||||
};
|
||||
actual = getStyles (let
|
||||
p = style.component elems.p "class" { style = { color = "blue"; }; };
|
||||
g = style.component elems.div "class2" { style = { color = "green"; }; };
|
||||
(it "gets all styles" {
|
||||
expected = {
|
||||
"p" = {};
|
||||
"div" = {};
|
||||
"p.class" = {color = "blue";};
|
||||
"div.class2" = {color = "green";};
|
||||
};
|
||||
actual = getStyles (let
|
||||
p = style.component elems.p "class" {style = {color = "blue";};};
|
||||
g = style.component elems.div "class2" {style = {color = "green";};};
|
||||
in {
|
||||
"index.html" = p "";
|
||||
blog = {"index.html" = g "";};
|
||||
});
|
||||
removeDunders = true;
|
||||
})
|
||||
|
||||
(it "gets top level paths" {
|
||||
actual = getPaths {
|
||||
something = "";
|
||||
src = ./src/index.md;
|
||||
};
|
||||
expected = {"index.md" = ./src/index.md;};
|
||||
})
|
||||
(it "gets lower level paths" {
|
||||
actual = getPaths {
|
||||
something = "yes";
|
||||
a-list = [
|
||||
{thingy = ./src/index.md;}
|
||||
[(html.tag "img" {src = ./src/favicon.png;} "")]
|
||||
];
|
||||
};
|
||||
expected = {
|
||||
"index.md" = ./src/index.md;
|
||||
"favicon.png" = ./src/favicon.png;
|
||||
};
|
||||
})
|
||||
|
||||
(it "switches paths" {
|
||||
actual = switchPaths {
|
||||
something = "";
|
||||
a-thing = {src = ./src/index.md;};
|
||||
a-list = [{thingy = ./src/index.md;}];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = {src = "/static/index.md";};
|
||||
a-list = [{thingy = "/static/index.md";}];
|
||||
};
|
||||
})
|
||||
|
||||
(it "extracts paths" {
|
||||
actual = extractPaths {
|
||||
something = "";
|
||||
a-thing = {src = ./src/index.md;};
|
||||
a-list = [{thingy = ./src/index.md;}];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = {src = "/static/index.md";};
|
||||
a-list = [{thingy = "/static/index.md";}];
|
||||
static = {"index.md" = ./src/index.md;};
|
||||
};
|
||||
})
|
||||
|
||||
(it "switches links" (let
|
||||
coolPage = {
|
||||
type = "link";
|
||||
name = "cool-page";
|
||||
content = "";
|
||||
};
|
||||
in {
|
||||
"index.html" = p "";
|
||||
blog = { "index.html" = g ""; };
|
||||
});
|
||||
removeDunders = true;
|
||||
})
|
||||
actual = switchLinks {
|
||||
something = "";
|
||||
a-thing = {src = coolPage;};
|
||||
a-list = [{thingy = coolPage;}];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = {src = "/static/cool-page";};
|
||||
a-list = [{thingy = "/static/cool-page";}];
|
||||
};
|
||||
}))
|
||||
|
||||
(it "gets top level paths" {
|
||||
actual = getPaths {
|
||||
something = "";
|
||||
src = ./src/index.md;
|
||||
};
|
||||
expected = { "index.md" = ./src/index.md; };
|
||||
})
|
||||
(it "gets lower level paths" {
|
||||
actual = getPaths {
|
||||
something = "yes";
|
||||
a-list = [
|
||||
{ thingy = ./src/index.md; }
|
||||
[ (html.tag "img" { src = ./src/favicon.png; } "") ]
|
||||
];
|
||||
};
|
||||
expected = {
|
||||
"index.md" = ./src/index.md;
|
||||
"favicon.png" = ./src/favicon.png;
|
||||
};
|
||||
})
|
||||
|
||||
(it "switches paths" {
|
||||
actual = switchPaths {
|
||||
something = "";
|
||||
a-thing = { src = ./src/index.md; };
|
||||
a-list = [{ thingy = ./src/index.md; }];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = { src = "/static/index.md"; };
|
||||
a-list = [{ thingy = "/static/index.md"; }];
|
||||
};
|
||||
})
|
||||
|
||||
(it "extracts paths" {
|
||||
actual = extractPaths {
|
||||
something = "";
|
||||
a-thing = { src = ./src/index.md; };
|
||||
a-list = [{ thingy = ./src/index.md; }];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = { src = "/static/index.md"; };
|
||||
a-list = [{ thingy = "/static/index.md"; }];
|
||||
static = { "index.md" = ./src/index.md; };
|
||||
};
|
||||
})
|
||||
|
||||
(it "switches links" (let
|
||||
coolPage = {
|
||||
type = "link";
|
||||
name = "cool-page";
|
||||
content = "";
|
||||
};
|
||||
in {
|
||||
actual = switchLinks {
|
||||
something = "";
|
||||
a-thing = { src = coolPage; };
|
||||
a-list = [{ thingy = coolPage; }];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = { src = "/static/cool-page"; };
|
||||
a-list = [{ thingy = "/static/cool-page"; }];
|
||||
};
|
||||
}))
|
||||
|
||||
(it "gets links" (let
|
||||
coolPage = {
|
||||
type = "link";
|
||||
name = "cool-page";
|
||||
content = "cool content";
|
||||
};
|
||||
otherPage = {
|
||||
type = "link";
|
||||
name = "page2";
|
||||
content = "stuff";
|
||||
};
|
||||
in {
|
||||
actual = getLinks {
|
||||
something = "yes";
|
||||
a-list =
|
||||
[ { thingy = coolPage; } [ (elems.img { src = otherPage; } "") ] ];
|
||||
};
|
||||
expected = {
|
||||
"cool-page" = "cool content";
|
||||
"page2" = "stuff";
|
||||
};
|
||||
}))
|
||||
|
||||
(it "extracts links" (let
|
||||
coolPage = {
|
||||
type = "link";
|
||||
name = "cool-page";
|
||||
content = "cool content";
|
||||
};
|
||||
otherPage = {
|
||||
type = "link";
|
||||
name = "page2";
|
||||
content = "stuff";
|
||||
};
|
||||
|
||||
in {
|
||||
actual = extractLinks {
|
||||
something = "";
|
||||
a-thing = { src = coolPage; };
|
||||
a-list = [{ thingy = otherPage; }];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = { src = "/static/cool-page"; };
|
||||
a-list = [{ thingy = "/static/page2"; }];
|
||||
static = {
|
||||
(it "gets links" (let
|
||||
coolPage = {
|
||||
type = "link";
|
||||
name = "cool-page";
|
||||
content = "cool content";
|
||||
};
|
||||
otherPage = {
|
||||
type = "link";
|
||||
name = "page2";
|
||||
content = "stuff";
|
||||
};
|
||||
in {
|
||||
actual = getLinks {
|
||||
something = "yes";
|
||||
a-list = [{thingy = coolPage;} [(elems.img {src = otherPage;} "")]];
|
||||
};
|
||||
expected = {
|
||||
"cool-page" = "cool content";
|
||||
"page2" = "stuff";
|
||||
};
|
||||
};
|
||||
}))
|
||||
}))
|
||||
|
||||
(it "copies all the files" ({
|
||||
actual = copyTo "." {
|
||||
page = "this is a page";
|
||||
subdir = {
|
||||
page = "this page is in a subdir";
|
||||
link = ./src;
|
||||
(it "extracts links" (let
|
||||
coolPage = {
|
||||
type = "link";
|
||||
name = "cool-page";
|
||||
content = "cool content";
|
||||
};
|
||||
};
|
||||
expected = ''
|
||||
cp /nix/store/crirfz0n6f8dgl1si3x7pwyw7fqm0r8l-page ./page
|
||||
mkdir -p ./subdir
|
||||
cp -r /nix/store/q95cn7ccixzi9w22aic4bl0ykk40ka7v-src ./subdir/link
|
||||
cp /nix/store/ic6fyy8wg8r4338a3m5kinmg11igxsyj-page ./subdir/page
|
||||
otherPage = {
|
||||
type = "link";
|
||||
name = "page2";
|
||||
content = "stuff";
|
||||
};
|
||||
in {
|
||||
actual = extractLinks {
|
||||
something = "";
|
||||
a-thing = {src = coolPage;};
|
||||
a-list = [{thingy = otherPage;}];
|
||||
};
|
||||
expected = {
|
||||
something = "";
|
||||
a-thing = {src = "/static/cool-page";};
|
||||
a-list = [{thingy = "/static/page2";}];
|
||||
static = {
|
||||
"cool-page" = "cool content";
|
||||
"page2" = "stuff";
|
||||
};
|
||||
};
|
||||
}))
|
||||
|
||||
'';
|
||||
}))
|
||||
(it "copies all the files" {
|
||||
actual = copyTo "." {
|
||||
page = "this is a page";
|
||||
subdir = {
|
||||
page = "this page is in a subdir";
|
||||
link = ./src;
|
||||
};
|
||||
};
|
||||
expected = ''
|
||||
cp /nix/store/crirfz0n6f8dgl1si3x7pwyw7fqm0r8l-page ./page
|
||||
mkdir -p ./subdir
|
||||
cp -r /nix/store/q95cn7ccixzi9w22aic4bl0ykk40ka7v-src ./subdir/link
|
||||
cp /nix/store/ic6fyy8wg8r4338a3m5kinmg11igxsyj-page ./subdir/page
|
||||
|
||||
(it "throws with a list for a page" ({
|
||||
actual = copyTo "." { page = [ ]; };
|
||||
throws = true;
|
||||
}))
|
||||
'';
|
||||
})
|
||||
|
||||
(it "throws with null for a page" ({
|
||||
actual = copyTo "." { page = null; };
|
||||
throws = true;
|
||||
}))
|
||||
(it "throws with a list for a page" {
|
||||
actual = copyTo "." {page = [];};
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "throws with a bool for a page" ({
|
||||
actual = copyTo "." { page = true; };
|
||||
throws = true;
|
||||
}))
|
||||
(it "throws with null for a page" {
|
||||
actual = copyTo "." {page = null;};
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "throws with a number for a page" ({
|
||||
actual = copyTo "." { page = 5; };
|
||||
throws = true;
|
||||
}))
|
||||
(it "throws with a bool for a page" {
|
||||
actual = copyTo "." {page = true;};
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "prepares the site" ({
|
||||
actual = prepare { favicon = ./src/favicon.png; } {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [ (elems.title { } "foobar") ])
|
||||
(elems.main { } [
|
||||
(elems.a {
|
||||
href = {
|
||||
type = "link";
|
||||
name = "a-page";
|
||||
content = "this is another page";
|
||||
};
|
||||
} "A Page")
|
||||
])
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [ (elems.title { } "foobar") ])
|
||||
(elems.main { } "something")
|
||||
(it "throws with a number for a page" {
|
||||
actual = copyTo "." {page = 5;};
|
||||
throws = true;
|
||||
})
|
||||
|
||||
(it "prepares the site" {
|
||||
actual = prepare {favicon = ./src/favicon.png;} {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [(elems.title {} "foobar")])
|
||||
(elems.main {} [
|
||||
(elems.a {
|
||||
href = {
|
||||
type = "link";
|
||||
name = "a-page";
|
||||
content = "this is another page";
|
||||
};
|
||||
} "A Page")
|
||||
])
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [(elems.title {} "foobar")])
|
||||
(elems.main {} "something")
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
expected = {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [
|
||||
(elems.title { } "foobar")
|
||||
(elems.link {
|
||||
rel = "shortcut icon";
|
||||
href = "/static/favicon.png";
|
||||
})
|
||||
(elems.Stylesheet "/style.css")
|
||||
])
|
||||
(elems.main { } [ (elems.a { href = "/static/a-page"; } "A Page") ])
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html { } [
|
||||
(elems.head { } [
|
||||
(elems.title { } "foobar")
|
||||
expected = {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [
|
||||
(elems.title {} "foobar")
|
||||
(elems.link {
|
||||
rel = "shortcut icon";
|
||||
href = "/static/favicon.png";
|
||||
})
|
||||
(elems.Stylesheet "/style.css")
|
||||
])
|
||||
(elems.main { } "something")
|
||||
(elems.main {} [(elems.a {href = "/static/a-page";} "A Page")])
|
||||
];
|
||||
blog = {
|
||||
"index.html" = elems.html {} [
|
||||
(elems.head {} [
|
||||
(elems.title {} "foobar")
|
||||
(elems.link {
|
||||
rel = "shortcut icon";
|
||||
href = "/static/favicon.png";
|
||||
})
|
||||
(elems.Stylesheet "/style.css")
|
||||
])
|
||||
(elems.main {} "something")
|
||||
];
|
||||
};
|
||||
static = {
|
||||
"favicon.png" = ./src/favicon.png;
|
||||
"a-page" = "this is another page";
|
||||
};
|
||||
"style.css" = "";
|
||||
};
|
||||
static = {
|
||||
"favicon.png" = ./src/favicon.png;
|
||||
"a-page" = "this is another page";
|
||||
};
|
||||
"style.css" = "";
|
||||
};
|
||||
asJSON = true;
|
||||
}))
|
||||
|
||||
]
|
||||
asJSON = true;
|
||||
})
|
||||
]
|
||||
|
|
|
@ -1,54 +1,53 @@
|
|||
{ it, ... }:
|
||||
let
|
||||
{it, ...}: let
|
||||
style = import ../nixite/style.nix;
|
||||
elems = import ../nixite/elems.nix;
|
||||
in [
|
||||
|
||||
(it "fetches empty style" (let para = (style.component elems.p "para" { });
|
||||
(it "fetches empty style" (let
|
||||
para = style.component elems.p "para" {};
|
||||
in {
|
||||
expected = {
|
||||
"p" = { };
|
||||
"p.para" = { };
|
||||
"p" = {};
|
||||
"p.para" = {};
|
||||
};
|
||||
actual = style.getStyle (para "");
|
||||
}))
|
||||
|
||||
(it "fetches style" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (style.component elems.p "para" attrs);
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = style.component elems.p "para" attrs;
|
||||
in {
|
||||
expected = {
|
||||
"p" = { };
|
||||
"p" = {};
|
||||
"p.para" = attrs.style;
|
||||
};
|
||||
actual = style.getStyle (para "");
|
||||
}))
|
||||
|
||||
(it "appliess class" (let
|
||||
attrs = { style = { foo = "bar"; }; };
|
||||
para = (style.component elems.p "para" attrs);
|
||||
attrs = {style = {foo = "bar";};};
|
||||
para = style.component elems.p "para" attrs;
|
||||
in {
|
||||
expected = [ "para" ];
|
||||
expected = ["para"];
|
||||
actual = (para "").attrs.class;
|
||||
}))
|
||||
|
||||
(it "applies classes from props" (let
|
||||
attrs = {
|
||||
style = { foo = "bar"; };
|
||||
class = [ "other" "class" ];
|
||||
style = {foo = "bar";};
|
||||
class = ["other" "class"];
|
||||
};
|
||||
para = (style.component elems.p "para" attrs);
|
||||
para = style.component elems.p "para" attrs;
|
||||
in {
|
||||
expected = [ "para" "other" "class" ];
|
||||
expected = ["para" "other" "class"];
|
||||
actual = (para "").attrs.class;
|
||||
}))
|
||||
|
||||
(it "fetches style for class" (let
|
||||
s = { foo = "bar"; };
|
||||
para = (style.component elems.p "para" { style = s; });
|
||||
s = {foo = "bar";};
|
||||
para = style.component elems.p "para" {style = s;};
|
||||
in {
|
||||
expected = {
|
||||
"p" = { };
|
||||
"p" = {};
|
||||
"p.para" = s;
|
||||
};
|
||||
actual = style.getStyle (para "");
|
||||
|
@ -56,13 +55,13 @@ in [
|
|||
|
||||
(it "fetches style recursively" (let
|
||||
s = {
|
||||
"p" = { };
|
||||
"div" = { };
|
||||
"p.para" = { foo = "bar"; };
|
||||
"div.link" = { this = "that"; };
|
||||
"p" = {};
|
||||
"div" = {};
|
||||
"p.para" = {foo = "bar";};
|
||||
"div.link" = {this = "that";};
|
||||
};
|
||||
para = (style.component elems.p "para" { style = s."p.para"; });
|
||||
div = (style.component elems.div "link" { style = s."div.link"; });
|
||||
para = style.component elems.p "para" {style = s."p.para";};
|
||||
div = style.component elems.div "link" {style = s."div.link";};
|
||||
in {
|
||||
expected = s;
|
||||
actual = style.getStyles (para (div "hello"));
|
||||
|
@ -71,39 +70,39 @@ in [
|
|||
|
||||
(it "fetches style recursively through lists" (let
|
||||
s = {
|
||||
"p" = { };
|
||||
"div" = { };
|
||||
"p.para" = { foo = "bar"; };
|
||||
"div.link" = { this = "that"; };
|
||||
"p" = {};
|
||||
"div" = {};
|
||||
"p.para" = {foo = "bar";};
|
||||
"div.link" = {this = "that";};
|
||||
};
|
||||
para = (style.component elems.p "para" { style = s."p.para"; });
|
||||
a = (style.component elems.div "link" { style = s."div.link"; });
|
||||
para = style.component elems.p "para" {style = s."p.para";};
|
||||
a = style.component elems.div "link" {style = s."div.link";};
|
||||
in {
|
||||
expected = s;
|
||||
actual = style.getStyles (para [ (a "hello") ]);
|
||||
actual = style.getStyles (para [(a "hello")]);
|
||||
removeDunders = true;
|
||||
}))
|
||||
|
||||
(it "fetches style recursively with repeats" (let
|
||||
s = {
|
||||
"p" = { };
|
||||
"div" = { };
|
||||
"p.para" = { foo = "bar"; };
|
||||
"div.link" = { this = "that"; };
|
||||
"p" = {};
|
||||
"div" = {};
|
||||
"p.para" = {foo = "bar";};
|
||||
"div.link" = {this = "that";};
|
||||
};
|
||||
para = (style.component elems.p "para" { style = s."p.para"; });
|
||||
a = (style.component elems.div "link" { style = s."div.link"; });
|
||||
para = style.component elems.p "para" {style = s."p.para";};
|
||||
a = style.component elems.div "link" {style = s."div.link";};
|
||||
in {
|
||||
expected = s;
|
||||
actual = style.getStyles (para [ (a "hello") (a "hello") ]);
|
||||
actual = style.getStyles (para [(a "hello") (a "hello")]);
|
||||
removeDunders = true;
|
||||
}))
|
||||
|
||||
(it "converts styles to string" (let
|
||||
s = {
|
||||
"p" = { };
|
||||
"p.para" = { foo = "bar"; };
|
||||
"a.link" = { this = "that"; };
|
||||
"p" = {};
|
||||
"p.para" = {foo = "bar";};
|
||||
"a.link" = {this = "that";};
|
||||
};
|
||||
in {
|
||||
expected = ''
|
||||
|
@ -119,11 +118,11 @@ in [
|
|||
|
||||
(it "extends styled tags" (let
|
||||
s = {
|
||||
"p.para" = { foo = "bar"; };
|
||||
"p.oof" = { oof = "yes"; };
|
||||
"p.para" = {foo = "bar";};
|
||||
"p.oof" = {oof = "yes";};
|
||||
};
|
||||
para = (style.component elems.p "para" { style = s."p.para"; });
|
||||
para2 = (style.component para "oof" { style = s."p.oof"; });
|
||||
para = style.component elems.p "para" {style = s."p.para";};
|
||||
para2 = style.component para "oof" {style = s."p.oof";};
|
||||
in {
|
||||
expected = s;
|
||||
actual = style.getStyles (para2 "");
|
||||
|
@ -132,16 +131,15 @@ in [
|
|||
|
||||
(it "extends styled tags classes" (let
|
||||
s = {
|
||||
"p" = { };
|
||||
"div" = { };
|
||||
"p.para" = { foo = "bar"; };
|
||||
"p.para.oof" = { oof = "yes"; };
|
||||
"p" = {};
|
||||
"div" = {};
|
||||
"p.para" = {foo = "bar";};
|
||||
"p.para.oof" = {oof = "yes";};
|
||||
};
|
||||
para = (style.component elems.p "para" { style = s."p.para"; });
|
||||
para2 = (style.component para "oof" { style = s."p.para.oof"; });
|
||||
para = style.component elems.p "para" {style = s."p.para";};
|
||||
para2 = style.component para "oof" {style = s."p.para.oof";};
|
||||
in {
|
||||
expected = [ "para" "oof" ];
|
||||
expected = ["para" "oof"];
|
||||
actual = (para2 "").attrs.class;
|
||||
}))
|
||||
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue