Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 </style> | |
| 12 <p>Test for @media CSSOM <a href="http://crbug.com/651792">bug 651792</a>.</p> | |
| 13 <script> | |
| 14 var rules = document.styleSheets[0].cssRules; | |
| 15 test(function(){ | |
| 16 assert_equals(CSSRule.STYLE_RULE,1); | |
| 17 assert_equals(CSSRule.MEDIA_RULE,4); | |
| 18 assert_equals(rules.length, 2); | |
| 19 assert_equals(rules[0].type, 4); | |
| 20 assert_equals(rules[0].cssRules.length, 1); | |
| 21 assert_equals(rules[0].cssRules[0].type, 1); | |
| 22 assert_equals(rules[0].media.mediaText, "screen and (min-width: 480px)") ; | |
| 23 assert_equals(rules[0].conditionText, "screen and (min-width: 480px)"); | |
| 24 assert_equals(rules[0].media.mediaText,rules[0].conditionText); | |
| 25 assert_equals(rules[0].cssText, | |
| 26 "@media screen and (min-width: 480px) { \n" + | |
| 27 " body { background-color: lightgreen; }\n" + | |
| 28 "}"); | |
| 29 }, "@media inherited from CSSConditionRule."); | |
|
foolip
2016/10/17 09:25:40
Can you add explicit tests for the prototype chain
| |
| 30 | |
| 31 test(function(){ | |
| 32 assert_equals(CSSRule.STYLE_RULE,1); | |
| 33 assert_equals(CSSRule.MEDIA_RULE,4); | |
| 34 assert_equals(rules.length, 2); | |
| 35 assert_equals(rules[1].type, 4); | |
| 36 assert_equals(rules[1].cssRules.length, 1); | |
| 37 assert_equals(rules[1].cssRules[0].type, 1); | |
| 38 assert_equals(rules[1].media.mediaText, ""); | |
| 39 assert_equals(rules[1].conditionText, ""); | |
| 40 assert_equals(rules[1].media.mediaText,rules[1].conditionText); | |
| 41 assert_equals(rules[1].cssText, | |
| 42 "@media { \n" + | |
| 43 " body { background-color: red; }\n" + | |
| 44 "}"); | |
| 45 }, "@media inherited from CSSConditionRule, empty media."); | |
| 46 </script> | |
| OLD | NEW |