Bug 1914685 - [wpt-sync] Update web-platform-tests to 26c88095d89792c886494e30c85aca3...
[gecko.git] / layout / style / test / test_condition_text.html
blobe2462979c2ba3d46f854cfbe3e449f2485b47a04
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=814907
5 -->
6 <head>
7 <title>Test for Bug 814907</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 <style id="style">
11 @media all {}
12 @media only color {}
13 @media (color ) {}
14 @media color \0061ND ( monochrome ) {}
15 @media (max-width: 200px), (color) {}
17 @supports(color: green){}
18 @supports (color: green) {}
19 @supports ((color: green)) {}
20 @supports (color: green) and (color: blue) {}
21 @supports ( Font: 20px serif ! Important) {}
22 </style>
23 </head>
24 <body>
25 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=814907">Mozilla Bug 814907</a>
26 <p id="display"></p>
27 <div id="content" style="display: none">
29 </div>
30 <pre id="test">
31 <script type="application/javascript">
33 /** Test for Bug 814907 **/
35 function runTest()
37 // re-parse the style sheet with the pref turned on
38 var style = document.getElementById("style");
39 style.textContent += " ";
41 var sheet = style.sheet;
43 var conditions = [
44 "all",
45 "only color",
46 "(color)",
47 "color and (monochrome)",
48 "(max-width: 200px), (color)",
49 "(color: green)",
50 "(color: green)",
51 "((color: green))",
52 "(color: green) and (color: blue)",
53 "( Font: 20px serif ! Important)"
56 is(sheet.cssRules.length, conditions.length);
58 for (var i = 0; i < sheet.cssRules.length; i++) {
59 var rule = sheet.cssRules[i];
60 is(rule.conditionText, conditions[i], "rule " + i + " has expected conditionText");
61 if (rule.type == CSSRule.MEDIA_RULE) {
62 is(rule.conditionText, rule.media.mediaText, "rule " + i + " conditionText matches media.mediaText");
66 SimpleTest.finish();
69 SimpleTest.waitForExplicitFinish();
70 runTest();
71 </script>
72 </pre>
73 </body>
74 </html>