Fix XHR statusText property to return just the text

In order to follow the spec the XHR statusText property should
return just the status text without the status code. Adding
tests to guard this behavior.
This commit is contained in:
Stefan Dobrev
2015-08-14 20:05:10 +03:00
parent 1f8bcc565c
commit 8c65427730
2 changed files with 19 additions and 1 deletions

View File

@@ -221,6 +221,24 @@ export function test_raises_onload_Event(done) {
xhr.send();
}
export function test_sets_status_and_statusText(done) {
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = () => {
if (xhr.readyState > 3) {
try {
TKUnit.assertEqual(xhr.status, 200);
TKUnit.assertEqual(xhr.statusText, 'OK');
done(null);
}
catch (err) {
done(err);
}
}
};
xhr.open("GET", "https://httpbin.org/get");
xhr.send();
}
export function test_raises_onerror_Event(done) {
let xhr = new XMLHttpRequest();
xhr.onerror = () => {