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

Side by Side Diff: third_party/WebKit/LayoutTests/css3/condition-cssom.html

Issue 2416893002: CSSMediaRule and CSSSupportsRule inherit from CSSConditionRule (Closed)
Patch Set: Add protype test Created 4 years, 2 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/css3/supports-cssom.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4 <style>
5 @media screen and (min-width: 480px) {
6 body { background-color: lightgreen; }
7 }
8 @media {
9 body { background-color: red; }
10 }
11 @supports (width: 0) {
12 s { width: 0; }
13 }
14 </style>
15 <p>Test for @media CSSOM <a href="http://crbug.com/651792">bug 651792</a>.</p>
16 <script>
17 test(function(){
18 assert_equals(Object.getPrototypeOf(CSSMediaRule.prototype), CSSConditio nRule.prototype);
19 assert_equals(Object.getPrototypeOf(CSSSupportsRule.prototype), CSSCondi tionRule.prototype);
20 }, "CSSConditionRule protype chain.");
21
22 var rules = document.styleSheets[0].cssRules;
23 test(function(){
24 assert_equals(CSSRule.STYLE_RULE,1);
25 assert_equals(CSSRule.MEDIA_RULE,4);
26 assert_equals(rules.length, 3);
27 assert_equals(rules[0].type, 4);
28 assert_equals(rules[0].cssRules.length, 1);
29 assert_equals(rules[0].cssRules[0].type, 1);
30 assert_equals(rules[0].media.mediaText, "screen and (min-width: 480px)") ;
31 assert_equals(rules[0].conditionText, "screen and (min-width: 480px)");
32 assert_equals(rules[0].media.mediaText,rules[0].conditionText);
33 assert_equals(rules[0].cssText,
34 "@media screen and (min-width: 480px) { \n" +
foolip 2016/10/17 14:23:01 Oh look, a trailing whitespace. Is that part of th
35 " body { background-color: lightgreen; }\n" +
36 "}");
37 }, "@media inherited from CSSConditionRule.");
38
39 test(function(){
40 assert_equals(rules.length, 3);
41 assert_equals(rules[1].type, 4);
42 assert_equals(rules[1].cssRules.length, 1);
43 assert_equals(rules[1].cssRules[0].type, 1);
44 assert_equals(rules[1].media.mediaText, "");
45 assert_equals(rules[1].conditionText, "");
46 assert_equals(rules[1].media.mediaText,rules[1].conditionText);
47 assert_equals(rules[1].cssText,
48 "@media { \n" +
49 " body { background-color: red; }\n" +
50 "}");
51 }, "@media inherited from CSSConditionRule, empty media.");
52
53 test(function(){
54 assert_equals(rules.length, 3);
55 assert_equals(rules[2].cssRules.length, 1);
56 assert_equals(rules[2].conditionText, "(width: 0)");
57 assert_equals(rules[2].cssText,
58 "@supports (width: 0) {\n" +
59 " s { width: 0px; }\n" +
60 "}");
61 }, "@supports inherited from CSSConditionRule.");
62 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/css3/supports-cssom.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698