styled components custom behavior

This commit is contained in:
tristan 2023-12-31 03:41:46 +00:00
parent 8ee2707ce6
commit 9d0d54c2e4
3 changed files with 22 additions and 5 deletions

View file

@ -21,7 +21,13 @@ let
})
(style.style "body" {
foo = "bar";
});
})
(style.styled "list" "ul" {
__child = child:
assert builtins.isList child;
(map (html.tag "li" {}) child);
} {})
;
in [
(it "makes a p component" {
expected = html.tag "p" {} "yes";
@ -42,6 +48,13 @@ in [
expected = html.tag "div" {class = ["foo" "bar"];} "foobar";
actual = my.foobar {} "foobar";
})
(it "does custom behavour" {
expected = toString (html.tag "ul" {} [
(html.tag "li" {} "1")
(html.tag "li" {} "2")
]);
actual = toString ( my.list {} ["1" "2"] );
})
(it "combines attrs" {
expected = html.tag "div" {
id = "foo";