{ describe, it, ... }: let style = import ../nixite/style.nix; elems = import ../nixite/elems.nix; in describe "getStyle" [ (it "fetches empty style" (let para = style.component elems.p "para" {}; in { expected = { "p" = {}; "p.para" = {}; }; actual = style.getStyle (para ""); })) (it "fetches style" (let attrs = {style = {foo = "bar";};}; para = style.component elems.p "para" attrs; in { expected = { "p" = {}; "p.para" = attrs.style; }; actual = style.getStyle (para ""); })) (it "fetches style for class" (let s = {foo = "bar";}; para = style.component elems.p "para" {style = s;}; in { expected = { "p" = {}; "p.para" = s; }; actual = style.getStyle (para ""); })) ] ++ describe "component" [ (it "applies class" (let attrs = {style = {foo = "bar";};}; para = style.component elems.p "para" attrs; in { expected = ["para"]; actual = (para "").attrs.class; })) (it "applies classes from props" (let attrs = { style = {foo = "bar";}; class = ["other" "class"]; }; para = style.component elems.p "para" attrs; in { expected = ["para" "other" "class"]; actual = (para "").attrs.class; })) (it "extends styled tags classes" (let s = { "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";}; in { expected = ["para" "oof"]; actual = (para2 "").attrs.class; })) ] ++ describe "getStyles" [ (it "fetches style recursively" (let s = { "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";}; in { expected = s; actual = style.getStyles (para (div "hello")); removeDunders = true; })) (it "fetches style recursively through lists" (let s = { "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";}; in { expected = s; 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";}; }; 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")]); removeDunders = true; })) (it "extends styled tags" (let s = { "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";}; in { expected = s; actual = style.getStyles (para2 ""); removeDunders = true; })) ] ++ describe "stylesToString" [ (it "converts styles to string" (let s = { "p" = {}; "p.para" = {foo = "bar";}; "a.link" = {this = "that";}; }; in { expected = '' a.link { this: that; } p.para { foo: bar; } ''; actual = style.stylesToString s; })) ]