|
@@ -120,21 +120,23 @@ describe('HTTP error should not throw error event', (report, done) => {
|
120
|
120
|
xhr.open(method, `${TEST_SERVER_URL}/xhr-code/${code}`)
|
121
|
121
|
xhr.onreadystatechange = function() {
|
122
|
122
|
count++
|
123
|
|
- report(
|
124
|
|
- <Assert
|
125
|
|
- key={`#${count} response data of ${method} ${code} should be empty`}
|
126
|
|
- expect=""
|
127
|
|
- actual={xhr.response}/>,
|
128
|
|
- <Assert
|
129
|
|
- key={`#${count} status of ${method} ${code} should be ${code}`}
|
130
|
|
- expect={code}
|
131
|
|
- actual={xhr.status}/>
|
132
|
|
- )
|
|
123
|
+ if(this.readyState == XMLHttpRequest.DONE) {
|
|
124
|
+ report(
|
|
125
|
+ <Assert
|
|
126
|
+ key={`#${count} response data of ${method} ${code} should be empty`}
|
|
127
|
+ expect=""
|
|
128
|
+ actual={xhr.response}/>,
|
|
129
|
+ <Assert
|
|
130
|
+ key={`#${count} status of ${method} ${code} should be ${code}`}
|
|
131
|
+ expect={code}
|
|
132
|
+ actual={xhr.status}/>
|
|
133
|
+ )
|
|
134
|
+ }
|
133
|
135
|
}
|
134
|
136
|
xhr.onerror = function() {
|
135
|
137
|
report(
|
136
|
138
|
<Assert
|
137
|
|
- key={'HTTP error should not throw error event'}
|
|
139
|
+ key={`HTTP error ${code} should not throw error event`}
|
138
|
140
|
expect={false}
|
139
|
141
|
actual={true}/>)
|
140
|
142
|
}
|
|
@@ -237,6 +239,7 @@ describe('upload progress event test', (report, done) => {
|
237
|
239
|
}
|
238
|
240
|
xhr.onreadystatechange = function() {
|
239
|
241
|
if(this.readyState == XMLHttpRequest.DONE) {
|
|
242
|
+ console.log(xhr)
|
240
|
243
|
report(
|
241
|
244
|
<Assert key="reponse should correct"
|
242
|
245
|
expect={time}
|
|
@@ -304,6 +307,6 @@ describe('upload progress event should not be triggered when body is empty', (re
|
304
|
307
|
done()
|
305
|
308
|
}
|
306
|
309
|
}
|
307
|
|
- xhr.open('GET', `${TEST_SERVER_URL}/pulbic/github.png`)
|
|
310
|
+ xhr.open('GET', `${TEST_SERVER_URL}/public/github.png`)
|
308
|
311
|
xhr.send()
|
309
|
312
|
})
|