|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=815021 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 815021</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 <style id="style"> |
|
11 #a { text-transform: none } |
|
12 @media all { |
|
13 #a { text-transform: lowercase } |
|
14 } |
|
15 </style> |
|
16 </head> |
|
17 <body> |
|
18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815021">Mozilla Bug 815021</a> |
|
19 <p id="display"><span id=a></span></p> |
|
20 <div id="content" style="display: none"> |
|
21 |
|
22 </div> |
|
23 <pre id="test"> |
|
24 <script type="application/javascript"> |
|
25 |
|
26 /** Test for Bug 815021 **/ |
|
27 |
|
28 var sheet = document.getElementById("style").sheet; |
|
29 var rule = sheet.cssRules[1]; |
|
30 var a = document.getElementById("a"); |
|
31 |
|
32 function stylesApplied() { |
|
33 return window.getComputedStyle(a, "").textTransform == "lowercase"; |
|
34 } |
|
35 |
|
36 is(rule.type, CSSRule.MEDIA_RULE, "initial @media rule type"); |
|
37 is(rule.conditionText, "all", "initial @media rule conditionText"); |
|
38 ok(stylesApplied(), "initial @media rule applied"); |
|
39 |
|
40 // [value to set, value to check, whether styles should be applied] |
|
41 var media = [ |
|
42 ["not all", "not all", false], |
|
43 ["ALL ", "all", true], |
|
44 ["unknown", "unknown", false], |
|
45 ["(min-width:1px)", "(min-width: 1px)", true], |
|
46 ["(bad syntax", "not all", false], |
|
47 ["(max-width: 1px), (color)", "(max-width: 1px), (color)", true] |
|
48 ]; |
|
49 |
|
50 for (var i = 0; i < media.length; i++) { |
|
51 rule.conditionText = media[i][0]; |
|
52 is(rule.conditionText, media[i][1], "value of conditionText #" + i); |
|
53 ok(rule.cssText.startsWith("@media " + media[i][1]), "value of cssText #" + i); |
|
54 ok(stylesApplied() == media[i][2], "styles applied #" + i); |
|
55 } |
|
56 </script> |
|
57 </pre> |
|
58 </body> |
|
59 </html> |