OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 function print(message, color) | 4 function print(message, color) |
5 { | 5 { |
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 window.history.forward(); | 72 window.history.forward(); |
73 // history.forward() is asychronous, location should be unchanged | 73 // history.forward() is asychronous, location should be unchanged |
74 shouldBe('window.location.hash', ''); | 74 shouldBe('window.location.hash', ''); |
75 shouldBe("window.location == originalLocation", true); | 75 shouldBe("window.location == originalLocation", true); |
76 // hashchange will jump to the next step. | 76 // hashchange will jump to the next step. |
77 break; | 77 break; |
78 case 7: | 78 case 7: |
79 shouldBe('window.location.hash', '#foo'); | 79 shouldBe('window.location.hash', '#foo'); |
80 shouldBe("window.location == originalLocation + '#foo'", true); | 80 shouldBe("window.location == originalLocation + '#foo'", true); |
81 window.location.hash = ''; | 81 window.location.hash = ''; |
| 82 shouldBe('window.location.hash', ''); |
| 83 shouldBe("window.location == originalLocation + '#'", true); |
| 84 window.location.hash = '#'; |
| 85 shouldBe('window.location.hash', ''); |
| 86 shouldBe("window.location == originalLocation + '#'", true); |
82 if (numErrors == 0) | 87 if (numErrors == 0) |
83 print("SUCCESS!", "green") | 88 print("SUCCESS!", "green") |
84 else | 89 else |
85 print("FAILURE: one or more tests failed", "red"); | 90 print("FAILURE: one or more tests failed", "red"); |
86 | 91 |
87 if (window.testRunner) | 92 if (window.testRunner) |
88 testRunner.notifyDone(); | 93 testRunner.notifyDone(); |
89 | 94 |
90 return; | 95 return; |
91 } | 96 } |
(...skipping 17 matching lines...) Expand all Loading... |
109 setTimeout(step, 0); | 114 setTimeout(step, 0); |
110 } | 115 } |
111 </script> | 116 </script> |
112 </head> | 117 </head> |
113 <body onload="runTests();"> | 118 <body onload="runTests();"> |
114 <p>This tests that modifying location.hash works as it should</p> | 119 <p>This tests that modifying location.hash works as it should</p> |
115 <div id="console"> | 120 <div id="console"> |
116 </div> | 121 </div> |
117 </body> | 122 </body> |
118 </html> | 123 </html> |
OLD | NEW |