| 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; |
| 11 document.getElementById("console").appendChild(paragraph); | 11 document.getElementById("console").appendChild(paragraph); |
| 12 } | 12 } |
| 13 | 13 |
| 14 function shouldBe(a, b) | 14 function shouldBe(a, b) |
| 15 { | 15 { |
| 16 var message, color; | 16 var message, color; |
| 17 var evalA; | 17 var evalA; |
| 18 try { | 18 try { |
| 19 evalA = eval(a); | 19 evalA = eval(a); |
| 20 } catch (e) { | 20 } catch (e) { |
| 21 evalA = e; | 21 evalA = e; |
| 22 } | 22 } |
| 23 | 23 |
| 24 if (evalA == b) { | 24 if (evalA == b) { |
| 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, 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.STYLE_RULE", 1); | 42 shouldBe("cssRule.STYLE_RULE", 1); |
| 43 shouldBe("cssRule.CHARSET_RULE", 2); | 43 shouldBe("cssRule.CHARSET_RULE", 2); |
| 44 shouldBe("cssRule.IMPORT_RULE", 3); | 44 shouldBe("cssRule.IMPORT_RULE", 3); |
| 45 shouldBe("cssRule.MEDIA_RULE", 4); | 45 shouldBe("cssRule.MEDIA_RULE", 4); |
| 46 shouldBe("cssRule.FONT_FACE_RULE", 5); | 46 shouldBe("cssRule.FONT_FACE_RULE", 5); |
| 47 shouldBe("cssRule.PAGE_RULE", 6); | 47 shouldBe("cssRule.PAGE_RULE", 6); |
| 48 | 48 |
| 49 shouldBe("window.CSSRule.STYLE_RULE", 1); | 49 shouldBe("window.CSSRule.STYLE_RULE", 1); |
| 50 shouldBe("window.CSSRule.CHARSET_RULE", 2); | 50 shouldBe("window.CSSRule.CHARSET_RULE", 2); |
| 51 shouldBe("window.CSSRule.IMPORT_RULE", 3); | 51 shouldBe("window.CSSRule.IMPORT_RULE", 3); |
| 52 shouldBe("window.CSSRule.MEDIA_RULE", 4); | 52 shouldBe("window.CSSRule.MEDIA_RULE", 4); |
| 53 shouldBe("window.CSSRule.FONT_FACE_RULE", 5); | 53 shouldBe("window.CSSRule.FONT_FACE_RULE", 5); |
| 54 shouldBe("window.CSSRule.PAGE_RULE", 6); | 54 shouldBe("window.CSSRule.PAGE_RULE", 6); |
| 55 | 55 |
| 56 var nodeIterator; | 56 var nodeIterator; |
| 57 try { | 57 try { |
| 58 nodeIterator = document.createNodeIterator(document, | 58 nodeIterator = document.createNodeIterator(document, |
| 59 NodeFilter.SHOW_ELEMENT, | 59 NodeFilter.SHOW_ELEMENT, |
| 60 function () { return NodeFilt
er.FILTER_ACCEPT; }, | 60 function () { return NodeFilt
er.FILTER_ACCEPT; }, |
| 61 false); | 61 false); |
| 62 } catch(e) { | 62 } catch(e) { |
| 63 nodeIterator = new Object(); | 63 nodeIterator = new Object(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 nodeFilter = nodeIterator.filter; | 66 nodeFilter = nodeIterator.filter; |
| 67 shouldBe("nodeFilter.FILTER_ACCEPT", 1); | 67 shouldBe("nodeFilter.FILTER_ACCEPT", 1); |
| 68 shouldBe("nodeFilter.FILTER_REJECT", 2); | 68 shouldBe("nodeFilter.FILTER_REJECT", 2); |
| 69 shouldBe("nodeFilter.FILTER_SKIP", 3); | 69 shouldBe("nodeFilter.FILTER_SKIP", 3); |
| 70 shouldBe("nodeFilter.SHOW_ALL", 4294967295); | 70 shouldBe("nodeFilter.SHOW_ALL", 4294967295); |
| 71 shouldBe("nodeFilter.SHOW_ELEMENT", 0x00000001); | 71 shouldBe("nodeFilter.SHOW_ELEMENT", 0x00000001); |
| 72 shouldBe("nodeFilter.SHOW_ATTRIBUTE", 0x00000002); | 72 shouldBe("nodeFilter.SHOW_ATTRIBUTE", 0x00000002); |
| 73 shouldBe("nodeFilter.SHOW_TEXT", 0x00000004); | 73 shouldBe("nodeFilter.SHOW_TEXT", 0x00000004); |
| 74 shouldBe("nodeFilter.SHOW_CDATA_SECTION", 0x00000008); | 74 shouldBe("nodeFilter.SHOW_CDATA_SECTION", 0x00000008); |
| 75 shouldBe("nodeFilter.SHOW_ENTITY_REFERENCE", 0x00000010); | 75 shouldBe("nodeFilter.SHOW_ENTITY_REFERENCE", 0x00000010); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 96 shouldBe("window.NodeFilter.SHOW_DOCUMENT", 0x00000100); | 96 shouldBe("window.NodeFilter.SHOW_DOCUMENT", 0x00000100); |
| 97 shouldBe("window.NodeFilter.SHOW_DOCUMENT_TYPE", 0x00000200); | 97 shouldBe("window.NodeFilter.SHOW_DOCUMENT_TYPE", 0x00000200); |
| 98 shouldBe("window.NodeFilter.SHOW_DOCUMENT_FRAGMENT", 0x00000400); | 98 shouldBe("window.NodeFilter.SHOW_DOCUMENT_FRAGMENT", 0x00000400); |
| 99 shouldBe("window.NodeFilter.SHOW_NOTATION", 0x00000800); | 99 shouldBe("window.NodeFilter.SHOW_NOTATION", 0x00000800); |
| 100 | 100 |
| 101 event = document.createEvent("Event"); | 101 event = document.createEvent("Event"); |
| 102 shouldBe("event.NONE", 0); | 102 shouldBe("event.NONE", 0); |
| 103 shouldBe("event.CAPTURING_PHASE", 1); | 103 shouldBe("event.CAPTURING_PHASE", 1); |
| 104 shouldBe("event.AT_TARGET", 2); | 104 shouldBe("event.AT_TARGET", 2); |
| 105 shouldBe("event.BUBBLING_PHASE", 3); | 105 shouldBe("event.BUBBLING_PHASE", 3); |
| 106 shouldBe("event.MOUSEDOWN", 1); | |
| 107 shouldBe("event.MOUSEUP", 2); | |
| 108 shouldBe("event.MOUSEOVER", 4); | |
| 109 shouldBe("event.MOUSEOUT", 8); | |
| 110 shouldBe("event.MOUSEMOVE", 16); | |
| 111 shouldBe("event.MOUSEDRAG", 32); | |
| 112 shouldBe("event.CLICK", 64); | |
| 113 shouldBe("event.DBLCLICK", 128); | |
| 114 shouldBe("event.KEYDOWN", 256); | |
| 115 shouldBe("event.KEYUP", 512); | |
| 116 shouldBe("event.KEYPRESS", 1024); | |
| 117 shouldBe("event.DRAGDROP", 2048); | |
| 118 shouldBe("event.FOCUS", 4096); | |
| 119 shouldBe("event.BLUR", 8192); | |
| 120 shouldBe("event.SELECT", 16384); | |
| 121 shouldBe("event.CHANGE", 32768); | |
| 122 | 106 |
| 123 shouldBe("window.Event.NONE", 0); | 107 shouldBe("window.Event.NONE", 0); |
| 124 shouldBe("window.Event.CAPTURING_PHASE", 1); | 108 shouldBe("window.Event.CAPTURING_PHASE", 1); |
| 125 shouldBe("window.Event.AT_TARGET", 2); | 109 shouldBe("window.Event.AT_TARGET", 2); |
| 126 shouldBe("window.Event.BUBBLING_PHASE", 3); | 110 shouldBe("window.Event.BUBBLING_PHASE", 3); |
| 127 shouldBe("window.Event.MOUSEDOWN", 1); | |
| 128 shouldBe("window.Event.MOUSEUP", 2); | |
| 129 shouldBe("window.Event.MOUSEOVER", 4); | |
| 130 shouldBe("window.Event.MOUSEOUT", 8); | |
| 131 shouldBe("window.Event.MOUSEMOVE", 16); | |
| 132 shouldBe("window.Event.MOUSEDRAG", 32); | |
| 133 shouldBe("window.Event.CLICK", 64); | |
| 134 shouldBe("window.Event.DBLCLICK", 128); | |
| 135 shouldBe("window.Event.KEYDOWN", 256); | |
| 136 shouldBe("window.Event.KEYUP", 512); | |
| 137 shouldBe("window.Event.KEYPRESS", 1024); | |
| 138 shouldBe("window.Event.DRAGDROP", 2048); | |
| 139 shouldBe("window.Event.FOCUS", 4096); | |
| 140 shouldBe("window.Event.BLUR", 8192); | |
| 141 shouldBe("window.Event.SELECT", 16384); | |
| 142 shouldBe("window.Event.CHANGE", 32768); | |
| 143 } | 111 } |
| 144 </script> | 112 </script> |
| 145 </head> | 113 </head> |
| 146 <body onload="test();"> | 114 <body onload="test();"> |
| 147 <p>This page tests CSSRule, NodeFilter, and Event. It tests:</p> | 115 <p>This page tests CSSRule, NodeFilter, and Event. It tests:</p> |
| 148 <ol> | 116 <ol> |
| 149 <li>Whether their global constructors have the correct constant values</li> | 117 <li>Whether their global constructors have the correct constant values</li> |
| 150 <li>Whether their objects have the correct constant values</li> | 118 <li>Whether their objects have the correct constant values</li> |
| 151 </ol> | 119 </ol> |
| 152 <hr> | 120 <hr> |
| 153 <div id='console'></div> | 121 <div id='console'></div> |
| 154 </body> | 122 </body> |
| 155 </html> | 123 </html> |
| OLD | NEW |