fixed isNumber to angular.isNumber for mocks outside of angular

This commit is contained in:
Misko Hevery 2010-05-19 16:00:20 -07:00
parent 80e12276f4
commit 80bd0c273b
3 changed files with 4 additions and 4 deletions

View file

@ -234,7 +234,7 @@ angularService('$xhr', function($browser, $error, $log){
angularService('$xhr.error', function($log){ angularService('$xhr.error', function($log){
return function(request, response){ return function(request, response){
$log.error(response); $log.error('ERROR: XHR: ' + request.url, request, response);
}; };
}, {inject:['$log']}); }, {inject:['$log']});
@ -272,7 +272,7 @@ angularService('$xhr.bulk', function($xhr, $error, $log){
if (response.status == 200) { if (response.status == 200) {
(currentRequests[i].callback || noop)(response.status, response.response); (currentRequests[i].callback || noop)(response.status, response.response);
} else { } else {
$error(currentRequests[i], {status: response.status, body:response.response}); $error(currentRequests[i], response);
} }
} catch(e) { } catch(e) {
$log.error(e); $log.error(e);

View file

@ -54,7 +54,7 @@ function MockBrowser() {
var expect = expectations[method] || (expectations[method] = {}); var expect = expectations[method] || (expectations[method] = {});
return { return {
respond: function(code, response) { respond: function(code, response) {
if (!isNumber(code)) { if (!angular.isNumber(code)) {
response = code; response = code;
code = 200; code = 200;
} }

View file

@ -288,7 +288,7 @@ describe("service", function(){
expect(typeof cb).toEqual('function'); expect(typeof cb).toEqual('function');
expect($xhrError).wasCalledWith( expect($xhrError).wasCalledWith(
{url:'/req1', method:'GET', data:null, callback:cb}, {url:'/req1', method:'GET', data:null, callback:cb},
{status:404, body:'NotFound'}); {status:404, response:'NotFound'});
expect(log).toEqual('"second";DONE'); expect(log).toEqual('"second";DONE');
}); });