1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 #include "core/css/CSSTestHelper.h"
7 #include "core/css/RuleSet.h"
9 #include <gtest/gtest.h>
13 TEST(CSSSelector, Representations)
17 const char* cssRules =
18 "summary::-webkit-details-marker { }"
33 "div:not(.a) { }" // without class a
34 "div:not(:visited) { }" // without the visited pseudo class
36 "[attr=\"value\"] { }" // Exact equality
37 "[attr~=\"value\"] { }" // One of a space-separated list
38 "[attr^=\"value\"] { }" // Begins with
39 "[attr$=\"value\"] { }" // Ends with
40 "[attr*=\"value\"] { }" // Substring equal to
41 "[attr|=\"value\"] { }" // One of a hyphen-separated list
43 ".a .b { }" // .b is a descendant of .a
44 ".a > .b { }" // .b is a direct descendant of .a
45 ".a ~ .b { }" // .a precedes .b in sibling order
46 ".a + .b { }" // .a element immediately precedes .b in sibling order
47 ".a, .b { }" // matches .a or .b
51 helper.addCSSRules(cssRules);
52 EXPECT_EQ(30u, helper.ruleSet().ruleCount()); // .a, .b counts as two rules.
54 helper.ruleSet().show();