Merge branch 'master' of https://github.com/mooglemoogle/jasmine-ajax into mooglemoogle-master
- Merges #147 - Fixes #142
This commit is contained in:
commit
cef5bbcc6c
@ -278,6 +278,7 @@ getJasmineRequireObj().AjaxFakeRequest = function(eventBusFactory) {
|
||||
this.username = arguments[3];
|
||||
this.password = arguments[4];
|
||||
this.readyState = 1;
|
||||
this.requestHeaders = {};
|
||||
this.eventBus.trigger('readystatechange');
|
||||
},
|
||||
|
||||
|
@ -98,6 +98,20 @@ describe('FakeRequest', function() {
|
||||
expect(request.contentType()).toEqual('application/text+xml');
|
||||
});
|
||||
|
||||
it('clears the request headers when opened', function() {
|
||||
// Requirement #14 https://www.w3.org/TR/XMLHttpRequest/#the-open()-method
|
||||
var request = new this.FakeRequest();
|
||||
|
||||
request.setRequestHeader('X-Header1', 'value1');
|
||||
|
||||
expect(request.requestHeaders['X-Header1']).toEqual('value1');
|
||||
|
||||
request.open();
|
||||
|
||||
expect(request.requestHeaders['X-Header1']).not.toBeDefined();
|
||||
expect(request.requestHeaders).toEqual({});
|
||||
});
|
||||
|
||||
describe('managing readyState', function() {
|
||||
beforeEach(function() {
|
||||
this.request = new this.FakeRequest();
|
||||
|
@ -116,6 +116,7 @@ getJasmineRequireObj().AjaxFakeRequest = function(eventBusFactory) {
|
||||
this.username = arguments[3];
|
||||
this.password = arguments[4];
|
||||
this.readyState = 1;
|
||||
this.requestHeaders = {};
|
||||
this.eventBus.trigger('readystatechange');
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user