OLD | NEW |
| (Empty) |
1 <sky> | |
2 <import src="/sky/tests/resources/chai.sky" /> | |
3 <import src="/sky/tests/resources/mocha.sky" /> | |
4 <import src="/sky/framework/xmlhttprequest.sky" as="XMLHttpRequest" /> | |
5 <script> | |
6 describe("xmlhttprequest", function() { | |
7 it("should call onerror when endpoint does not exist", function(done) { | |
8 var xhr = new XMLHttpRequest(); | |
9 xhr.open("GET", "does_not_exist.html"); | |
10 xhr.onerror = function() { | |
11 assert.fail("onload", "onerror", "onerror should not be called."); | |
12 done(); | |
13 } | |
14 xhr.onload = function() { | |
15 // Missing files are application-level errors, not network errors | |
16 // so onload fires, not onerror. | |
17 assert.equal(xhr.status, 404); | |
18 assert.equal(xhr.statusText, "HTTP/1.1 404 Not Found", | |
19 "status text should also be 404"); | |
20 done(); | |
21 } | |
22 xhr.send(); | |
23 }); | |
24 }); | |
25 </script> | |
26 </sky> | |
OLD | NEW |