Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: Source/core/css/CSSSelectorTest.cpp

Issue 187353003: Implement /content/ combinator. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Patch for landing Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/css/CSSSelectorList.cpp ('k') | Source/core/css/RuleSetTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/css/CSSTestHelper.h" 6 #include "core/css/CSSTestHelper.h"
7 #include "core/css/RuleSet.h" 7 #include "core/css/RuleSet.h"
8 8
9 #include <gtest/gtest.h> 9 #include <gtest/gtest.h>
10 10
11 namespace WebCore { 11 namespace WebCore {
12 12
13 TEST(CSSSelector, Representations) 13 TEST(CSSSelector, Representations)
14 { 14 {
15 CSSTestHelper helper; 15 CSSTestHelper helper;
16 16
17 const char* cssRules = 17 const char* cssRules =
18 "summary::-webkit-details-marker { }" 18 "summary::-webkit-details-marker { }"
19 "* {}" 19 "* {}"
20 "div {}" 20 "div {}"
21 "#id {}" 21 "#id {}"
22 ".class {}" 22 ".class {}"
23 "[attr] {}" 23 "[attr] {}"
24 "div:hover {}" 24 "div:hover {}"
25 "div:nth-child(2){}" 25 "div:nth-child(2){}"
26 ".class#id { }" 26 ".class#id { }"
27 "#id.class { }" 27 "#id.class { }"
28 "[attr]#id { }" 28 "[attr]#id { }"
29 "div[attr]#id { }" 29 "div[attr]#id { }"
30 "div::content { }" 30 "video::cue { }"
31 "div::first-line { }" 31 "div::first-line { }"
32 ".a.b.c { }" 32 ".a.b.c { }"
33 "div:not(.a) { }" // without class a 33 "div:not(.a) { }" // without class a
34 "div:not(:visited) { }" // without the visited pseudo class 34 "div:not(:visited) { }" // without the visited pseudo class
35 35
36 "[attr=\"value\"] { }" // Exact equality 36 "[attr=\"value\"] { }" // Exact equality
37 "[attr~=\"value\"] { }" // One of a space-separated list 37 "[attr~=\"value\"] { }" // One of a space-separated list
38 "[attr^=\"value\"] { }" // Begins with 38 "[attr^=\"value\"] { }" // Begins with
39 "[attr$=\"value\"] { }" // Ends with 39 "[attr$=\"value\"] { }" // Ends with
40 "[attr*=\"value\"] { }" // Substring equal to 40 "[attr*=\"value\"] { }" // Substring equal to
41 "[attr|=\"value\"] { }" // One of a hyphen-separated list 41 "[attr|=\"value\"] { }" // One of a hyphen-separated list
42 42
43 ".a .b { }" // .b is a descendant of .a 43 ".a .b { }" // .b is a descendant of .a
44 ".a > .b { }" // .b is a direct descendant of .a 44 ".a > .b { }" // .b is a direct descendant of .a
45 ".a ~ .b { }" // .a precedes .b in sibling order 45 ".a ~ .b { }" // .a precedes .b in sibling order
46 ".a + .b { }" // .a element immediately precedes .b in sibling order 46 ".a + .b { }" // .a element immediately precedes .b in sibling order
47 ".a, .b { }" // matches .a or .b 47 ".a, .b { }" // matches .a or .b
48 48
49 ".a.b .c {}"; 49 ".a.b .c {}";
50 50
51 helper.addCSSRules(cssRules); 51 helper.addCSSRules(cssRules);
52 EXPECT_EQ(30u, helper.ruleSet().ruleCount()); // .a, .b counts as two rules. 52 EXPECT_EQ(30u, helper.ruleSet().ruleCount()); // .a, .b counts as two rules.
53 #ifndef NDEBUG 53 #ifndef NDEBUG
54 helper.ruleSet().show(); 54 helper.ruleSet().show();
55 #endif 55 #endif
56 } 56 }
57 57
58 } // namespace WebCore 58 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/CSSSelectorList.cpp ('k') | Source/core/css/RuleSetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698