feat(http): xhr error listener invokes throw on EventEmitter

Closes #2667
This commit is contained in:
gdi2290
2015-08-08 14:17:43 -07:00
committed by Jeff Cross
parent 3b9411cbeb
commit f2d3bdb801
2 changed files with 18 additions and 1 deletions
@@ -118,6 +118,15 @@ export function main() {
expect(abortSpy).toHaveBeenCalled();
});
it('should create an error Response on error', inject([AsyncTestCompleter], async => {
var connection = new XHRConnection(sampleRequest, new MockBrowserXHR(),
new ResponseOptions({type: ResponseTypes.Error}));
ObservableWrapper.subscribe(connection.response, null, res => {
expect(res.type).toBe(ResponseTypes.Error);
async.done();
});
existingXHRs[0].dispatchEvent('error');
}));
it('should automatically call open with method and url', () => {
new XHRConnection(sampleRequest, new MockBrowserXHR());