Skip to content

Commit 64456ca

Browse files
author
James Newell
committed
bug fix for jameslnewell#6
1 parent d2557e1 commit 64456ca

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

lib/MockXMLHttpRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ MockXMLHttpRequest.prototype.open = function(method, url, async, user, password)
117117
this.user = user;
118118
this.password = password;
119119
this.data = null;
120-
self.readyState = MockXMLHttpRequest.STATE_OPENED;
120+
this.readyState = MockXMLHttpRequest.STATE_OPENED;
121121
};
122122

123123
MockXMLHttpRequest.prototype.setRequestHeader = function(name, value) {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "xhr-mock",
3-
"version": "1.4.0",
3+
"version": "1.4.1",
44
"description": "Utility for mocking XMLHttpRequests in the browser.",
55
"keywords": [
66
"mock",

test/MockXMLHttpRequest.js

+13
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ describe('MockXMLHttpRequest', function() {
2929

3030
});
3131

32+
describe('.open()', function() {
33+
34+
it('should be OPENED', function() {
35+
36+
var xhr = new MockXMLHttpRequest();
37+
xhr.open('/');
38+
39+
assert.equal(xhr.readyState, MockXMLHttpRequest.STATE_OPENED);
40+
41+
});
42+
43+
});
44+
3245
describe('.send()', function() {
3346

3447
it('should have a request body', function (done) {

0 commit comments

Comments
 (0)