Renamed response function to makeResponse so that it doesn't conflict with the builtin method
This commit is contained in:
parent
54864a45d3
commit
f480e105c2
@ -212,7 +212,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
var stub = stubTracker.findStub(this.url, data);
|
var stub = stubTracker.findStub(this.url, data);
|
||||||
if (stub) {
|
if (stub) {
|
||||||
this.response(stub);
|
this.makeResponse(stub);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||||||
|
|
||||||
responseText: null,
|
responseText: null,
|
||||||
|
|
||||||
response: function(response) {
|
makeResponse: function(response) {
|
||||||
this.status = response.status;
|
this.status = response.status;
|
||||||
this.statusText = response.statusText || "";
|
this.statusText = response.statusText || "";
|
||||||
this.responseText = response.responseText || "";
|
this.responseText = response.responseText || "";
|
||||||
|
@ -77,7 +77,7 @@ describe("FakeXMLHttpRequest", function() {
|
|||||||
describe("when a response comes in", function() {
|
describe("when a response comes in", function() {
|
||||||
it("should have a readyState of 4 (loaded)", function() {
|
it("should have a readyState of 4 (loaded)", function() {
|
||||||
xhr.onreadystatechange.calls.reset();
|
xhr.onreadystatechange.calls.reset();
|
||||||
xhr.response({status: 200});
|
xhr.makeResponse({status: 200});
|
||||||
expect(xhr.readyState).toEqual(4);
|
expect(xhr.readyState).toEqual(4);
|
||||||
expect(xhr.onreadystatechange).toHaveBeenCalled();
|
expect(xhr.onreadystatechange).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
@ -187,7 +187,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
|||||||
|
|
||||||
request = mockAjax.requests.mostRecent();
|
request = mockAjax.requests.mostRecent();
|
||||||
response = {status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!"};
|
response = {status: 200, statusText: "OK", contentType: "text/html", responseText: "OK!"};
|
||||||
request.response(response);
|
request.makeResponse(response);
|
||||||
|
|
||||||
sharedContext.responseCallback = success;
|
sharedContext.responseCallback = success;
|
||||||
sharedContext.status = response.status;
|
sharedContext.status = response.status;
|
||||||
@ -222,7 +222,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
|||||||
request = mockAjax.requests.mostRecent();
|
request = mockAjax.requests.mostRecent();
|
||||||
var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}'};
|
var responseObject = {status: 200, statusText: "OK", contentType: "application/json", responseText: '{"foo":"bar"}'};
|
||||||
|
|
||||||
request.response(responseObject);
|
request.makeResponse(responseObject);
|
||||||
|
|
||||||
sharedContext.responseCallback = success;
|
sharedContext.responseCallback = success;
|
||||||
sharedContext.status = responseObject.status;
|
sharedContext.status = responseObject.status;
|
||||||
@ -262,7 +262,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
|||||||
|
|
||||||
request = mockAjax.requests.mostRecent();
|
request = mockAjax.requests.mostRecent();
|
||||||
response = {status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}'};
|
response = {status: 200, statusText: "OK", responseText: '{"foo": "valid JSON, dammit."}'};
|
||||||
request.response(response);
|
request.makeResponse(response);
|
||||||
|
|
||||||
sharedContext.responseCallback = success;
|
sharedContext.responseCallback = success;
|
||||||
sharedContext.status = response.status;
|
sharedContext.status = response.status;
|
||||||
@ -296,7 +296,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
|||||||
|
|
||||||
request = mockAjax.requests.mostRecent();
|
request = mockAjax.requests.mostRecent();
|
||||||
response = {status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}'};
|
response = {status: 0, statusText: "ABORT", responseText: '{"foo": "whoops!"}'};
|
||||||
request.response(response);
|
request.makeResponse(response);
|
||||||
|
|
||||||
sharedContext.responseCallback = error;
|
sharedContext.responseCallback = error;
|
||||||
sharedContext.status = 0;
|
sharedContext.status = 0;
|
||||||
@ -331,7 +331,7 @@ describe("Jasmine Mock Ajax (for toplevel)", function() {
|
|||||||
|
|
||||||
request = mockAjax.requests.mostRecent();
|
request = mockAjax.requests.mostRecent();
|
||||||
response = {status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){"};
|
response = {status: 500, statusText: "SERVER ERROR", contentType: "text/html", responseText: "(._){"};
|
||||||
request.response(response);
|
request.makeResponse(response);
|
||||||
|
|
||||||
sharedContext.responseCallback = error;
|
sharedContext.responseCallback = error;
|
||||||
sharedContext.status = response.status;
|
sharedContext.status = response.status;
|
||||||
|
Loading…
Reference in New Issue
Block a user