OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <link rel="stylesheet" href="resources/stylesheet.css"> | 3 <link rel="stylesheet" href="resources/stylesheet.css"> |
4 <script> | 4 <script> |
5 function print(message, color) { | 5 function print(message, color) { |
6 var paragraph = document.createElement("div"); | 6 var paragraph = document.createElement("div"); |
7 paragraph.appendChild(document.createTextNode(message)); | 7 paragraph.appendChild(document.createTextNode(message)); |
8 paragraph.style.fontFamily = "monospace"; | 8 paragraph.style.fontFamily = "monospace"; |
9 if (color) | 9 if (color) |
10 paragraph.style.color = color; | 10 paragraph.style.color = color; |
(...skipping 14 matching lines...) Expand all Loading... |
25 color = "green"; | 25 color = "green"; |
26 message = "PASS: " + a + " should be " + b + " and is."; | 26 message = "PASS: " + a + " should be " + b + " and is."; |
27 } else { | 27 } else { |
28 color = "red"; | 28 color = "red"; |
29 message = "FAIL: " + a + " should be " + b + " but instead is " + evalA
+ "."; | 29 message = "FAIL: " + a + " should be " + b + " but instead is " + evalA
+ "."; |
30 } | 30 } |
31 | 31 |
32 print(message, color); | 32 print(message, color); |
33 } | 33 } |
34 | 34 |
35 var cssRule, cssValue, nodeFilter, event; | 35 var cssRule, nodeFilter, event; |
36 | 36 |
37 function test() { | 37 function test() { |
38 if (window.testRunner) | 38 if (window.testRunner) |
39 testRunner.dumpAsText(); | 39 testRunner.dumpAsText(); |
40 | 40 |
41 cssRule = document.styleSheets[0].cssRules[0]; | 41 cssRule = document.styleSheets[0].cssRules[0]; |
42 shouldBe("cssRule.UNKNOWN_RULE", 0); | 42 shouldBe("cssRule.UNKNOWN_RULE", 0); |
43 shouldBe("cssRule.STYLE_RULE", 1); | 43 shouldBe("cssRule.STYLE_RULE", 1); |
44 shouldBe("cssRule.CHARSET_RULE", 2); | 44 shouldBe("cssRule.CHARSET_RULE", 2); |
45 shouldBe("cssRule.IMPORT_RULE", 3); | 45 shouldBe("cssRule.IMPORT_RULE", 3); |
46 shouldBe("cssRule.MEDIA_RULE", 4); | 46 shouldBe("cssRule.MEDIA_RULE", 4); |
47 shouldBe("cssRule.FONT_FACE_RULE", 5); | 47 shouldBe("cssRule.FONT_FACE_RULE", 5); |
48 shouldBe("cssRule.PAGE_RULE", 6); | 48 shouldBe("cssRule.PAGE_RULE", 6); |
49 | 49 |
50 shouldBe("window.CSSRule.UNKNOWN_RULE", 0); | 50 shouldBe("window.CSSRule.UNKNOWN_RULE", 0); |
51 shouldBe("window.CSSRule.STYLE_RULE", 1); | 51 shouldBe("window.CSSRule.STYLE_RULE", 1); |
52 shouldBe("window.CSSRule.CHARSET_RULE", 2); | 52 shouldBe("window.CSSRule.CHARSET_RULE", 2); |
53 shouldBe("window.CSSRule.IMPORT_RULE", 3); | 53 shouldBe("window.CSSRule.IMPORT_RULE", 3); |
54 shouldBe("window.CSSRule.MEDIA_RULE", 4); | 54 shouldBe("window.CSSRule.MEDIA_RULE", 4); |
55 shouldBe("window.CSSRule.FONT_FACE_RULE", 5); | 55 shouldBe("window.CSSRule.FONT_FACE_RULE", 5); |
56 shouldBe("window.CSSRule.PAGE_RULE", 6); | 56 shouldBe("window.CSSRule.PAGE_RULE", 6); |
57 | 57 |
58 cssValue = cssRule.style.getPropertyCSSValue("color"); | |
59 shouldBe("cssValue.CSS_INHERIT", 0); | |
60 shouldBe("cssValue.CSS_PRIMITIVE_VALUE", 1); | |
61 shouldBe("cssValue.CSS_VALUE_LIST", 2); | |
62 shouldBe("cssValue.CSS_CUSTOM", 3); | |
63 | |
64 shouldBe("window.CSSValue.CSS_INHERIT", 0); | |
65 shouldBe("window.CSSValue.CSS_PRIMITIVE_VALUE", 1); | |
66 shouldBe("window.CSSValue.CSS_VALUE_LIST", 2); | |
67 shouldBe("window.CSSValue.CSS_CUSTOM", 3); | |
68 | |
69 var nodeIterator; | 58 var nodeIterator; |
70 try { | 59 try { |
71 nodeIterator = document.createNodeIterator(document, | 60 nodeIterator = document.createNodeIterator(document, |
72 NodeFilter.SHOW_ELEMENT, | 61 NodeFilter.SHOW_ELEMENT, |
73 function () { return NodeFilt
er.FILTER_ACCEPT; }, | 62 function () { return NodeFilt
er.FILTER_ACCEPT; }, |
74 false); | 63 false); |
75 } catch(e) { | 64 } catch(e) { |
76 nodeIterator = new Object(); | 65 nodeIterator = new Object(); |
77 } | 66 } |
78 | 67 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 shouldBe("window.Event.KEYPRESS", 1024); | 139 shouldBe("window.Event.KEYPRESS", 1024); |
151 shouldBe("window.Event.DRAGDROP", 2048); | 140 shouldBe("window.Event.DRAGDROP", 2048); |
152 shouldBe("window.Event.FOCUS", 4096); | 141 shouldBe("window.Event.FOCUS", 4096); |
153 shouldBe("window.Event.BLUR", 8192); | 142 shouldBe("window.Event.BLUR", 8192); |
154 shouldBe("window.Event.SELECT", 16384); | 143 shouldBe("window.Event.SELECT", 16384); |
155 shouldBe("window.Event.CHANGE", 32768); | 144 shouldBe("window.Event.CHANGE", 32768); |
156 } | 145 } |
157 </script> | 146 </script> |
158 </head> | 147 </head> |
159 <body onload="test();"> | 148 <body onload="test();"> |
160 <p>This page tests CSSRule, CSSValue, NodeFilter, and Event. It tests:</p> | 149 <p>This page tests CSSRule, NodeFilter, and Event. It tests:</p> |
161 <ol> | 150 <ol> |
162 <li>Whether their global constructors have the correct constant values</li> | 151 <li>Whether their global constructors have the correct constant values</li> |
163 <li>Whether their objects have the correct constant values</li> | 152 <li>Whether their objects have the correct constant values</li> |
164 </ol> | 153 </ol> |
165 <hr> | 154 <hr> |
166 <div id='console'></div> | 155 <div id='console'></div> |
167 </body> | 156 </body> |
168 </html> | 157 </html> |
OLD | NEW |