fix css unit tests consistency
sort map attribute keys before generating style string so they always get generated in the same way
This commit is contained in:
parent
75cf36f0af
commit
983753c859
|
@ -34,7 +34,7 @@
|
||||||
(.append sb indent)
|
(.append sb indent)
|
||||||
(.append sb (css-rule-name-str names))
|
(.append sb (css-rule-name-str names))
|
||||||
(.append sb " {\n")
|
(.append sb " {\n")
|
||||||
(doseq [[attr-name attr-value] attrs]
|
(doseq [[attr-name attr-value] (sort-by first attrs)]
|
||||||
(when-let [attr-str (css-attr-str attr-name attr-value)]
|
(when-let [attr-str (css-attr-str attr-name attr-value)]
|
||||||
(.append sb attr-indent)
|
(.append sb attr-indent)
|
||||||
(.append sb attr-str)
|
(.append sb attr-str)
|
||||||
|
|
|
@ -50,9 +50,9 @@
|
||||||
(str (css-rule->str (StringBuilder.) [:p {}]))))
|
(str (css-rule->str (StringBuilder.) [:p {}]))))
|
||||||
(is (= "p {\n font-weight: bold;\n}\n"
|
(is (= "p {\n font-weight: bold;\n}\n"
|
||||||
(str (css-rule->str (StringBuilder.) [:p {:font-weight "bold"}]))))
|
(str (css-rule->str (StringBuilder.) [:p {:font-weight "bold"}]))))
|
||||||
(is (= "p {\n font-weight: bold;\n color: #000;\n}\n"
|
(is (= "p {\n color: #000;\n font-weight: bold;\n}\n"
|
||||||
(str (css-rule->str (StringBuilder.) [:p {:font-weight "bold" :color "#000"}]))))
|
(str (css-rule->str (StringBuilder.) [:p {:font-weight "bold" :color "#000"}]))))
|
||||||
(is (= "@page {\n size: 8.5in 11in;\n margin: 10%;\n @top-right {\n content: \"Page \" counter(page);\n }\n @top-left {\n content: \"Foobar\";\n border: solid red;\n }\n}\n"
|
(is (= "@page {\n margin: 10%;\n size: 8.5in 11in;\n @top-right {\n content: \"Page \" counter(page);\n }\n @top-left {\n border: solid red;\n content: \"Foobar\";\n }\n}\n"
|
||||||
(str (css-rule->str
|
(str (css-rule->str
|
||||||
(StringBuilder.)
|
(StringBuilder.)
|
||||||
["@page"
|
["@page"
|
||||||
|
@ -91,7 +91,7 @@
|
||||||
:color "black"}]
|
:color "black"}]
|
||||||
[:p
|
[:p
|
||||||
{:font-size "12pt"}]])))
|
{:font-size "12pt"}]])))
|
||||||
(is (= "body {\n background-color: white;\n color: black;\n}\n@page {\n size: 8.5in 11in;\n margin: 10%;\n @top-right {\n content: \"Page \" counter(page);\n }\n @top-left {\n content: \"Foobar\";\n border: solid red;\n }\n}\n"
|
(is (= "body {\n background-color: white;\n color: black;\n}\n@page {\n margin: 10%;\n size: 8.5in 11in;\n @top-right {\n content: \"Page \" counter(page);\n }\n @top-left {\n border: solid red;\n content: \"Foobar\";\n }\n}\n"
|
||||||
(css->str
|
(css->str
|
||||||
[[:body
|
[[:body
|
||||||
{:background-color "white"
|
{:background-color "white"
|
||||||
|
|
Loading…
Reference in a new issue