layout/style/test/test_condition_text_assignment.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

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

mercurial