Commit 0f1988b9 authored by jan.koester's avatar jan.koester
Browse files

test

parent 330d8d0f
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -97,8 +97,7 @@ int main(){
        using libhtmlpp::CSSStyleSheet;
        std::string css =
            ".box { color: red; font-size: 12px; }\n"
            ".box { color: blue; }\n"
            "#hero { color: green !important; }\n";
            ".box { color: blue; }\n";
        CSSStyleSheet sheet;
        sheet.parse(css);

@@ -109,9 +108,24 @@ int main(){
        sheet.collectApproximateMatches("div", "box", "hero", props, mediaRules, seen);

        check(props["color"] == "inline-value",
              "inline value beats a later plain rule, even !important's sibling rule order");
              "inline value beats a later plain (non-important) rule");
        check(props["font-size"] == "12px", "non-conflicting property still merged in");
    }
    {
        using libhtmlpp::CSSStyleSheet;
        std::string css = "#hero { color: green !important; }\n";
        CSSStyleSheet sheet;
        sheet.parse(css);

        std::map<std::string,std::string> props;
        props["color"] = "inline-value";
        std::string mediaRules;
        std::set<std::string> seen;
        sheet.collectApproximateMatches("div", "box", "hero", props, mediaRules, seen);

        check(props["color"] == "green",
              "an !important rule overrides even an inline-set value (matches real cascade precedence)");
    }
    {
        using libhtmlpp::CSSStyleSheet;
        std::string css =