summaryrefslogtreecommitdiffstats
path: root/js/vendor/angular-mocks/angular-mocks.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/vendor/angular-mocks/angular-mocks.js')
-rw-r--r--js/vendor/angular-mocks/angular-mocks.js66
1 files changed, 34 insertions, 32 deletions
diff --git a/js/vendor/angular-mocks/angular-mocks.js b/js/vendor/angular-mocks/angular-mocks.js
index ecbb22bcf..2f5cb5f9b 100644
--- a/js/vendor/angular-mocks/angular-mocks.js
+++ b/js/vendor/angular-mocks/angular-mocks.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.3.0
+ * @license AngularJS v1.3.1
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -74,7 +74,7 @@ angular.mock.$Browser = function() {
self.defer = function(fn, delay) {
delay = delay || 0;
self.deferredFns.push({time:(self.defer.now + delay), fn:fn, id: self.deferredNextId});
- self.deferredFns.sort(function(a,b){ return a.time - b.time;});
+ self.deferredFns.sort(function(a, b) { return a.time - b.time;});
return self.deferredNextId++;
};
@@ -142,7 +142,7 @@ angular.mock.$Browser.prototype = {
* run all fns in pollFns
*/
poll: function poll() {
- angular.forEach(this.pollFns, function(pollFn){
+ angular.forEach(this.pollFns, function(pollFn) {
pollFn();
});
},
@@ -258,7 +258,7 @@ angular.mock.$ExceptionHandlerProvider = function() {
* {@link ngMock.$log#reset reset()}
*/
this.mode = function(mode) {
- switch(mode) {
+ switch (mode) {
case 'rethrow':
handler = function(e) {
throw e;
@@ -316,7 +316,7 @@ angular.mock.$LogProvider = function() {
}
};
- this.$get = function () {
+ this.$get = function() {
var $log = {
log: function() { $log.log.logs.push(concat([], arguments, 0)); },
warn: function() { $log.warn.logs.push(concat([], arguments, 0)); },
@@ -336,7 +336,7 @@ angular.mock.$LogProvider = function() {
* @description
* Reset all of the logging arrays to empty.
*/
- $log.reset = function () {
+ $log.reset = function() {
/**
* @ngdoc property
* @name $log#log.logs
@@ -421,7 +421,7 @@ angular.mock.$LogProvider = function() {
var errors = [];
angular.forEach(['error', 'warn', 'info', 'log', 'debug'], function(logLevel) {
angular.forEach($log[logLevel].logs, function(log) {
- angular.forEach(log, function (logItem) {
+ angular.forEach(log, function(logItem) {
errors.push('MOCK $log (' + logLevel + '): ' + String(logItem) + '\n' +
(logItem.stack || ''));
});
@@ -504,7 +504,7 @@ angular.mock.$IntervalProvider = function() {
id: nextRepeatId,
deferred: deferred
});
- repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
+ repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;});
nextRepeatId++;
return promise;
@@ -520,7 +520,7 @@ angular.mock.$IntervalProvider = function() {
* @returns {boolean} Returns `true` if the task was successfully cancelled.
*/
$interval.cancel = function(promise) {
- if(!promise) return false;
+ if (!promise) return false;
var fnIndex;
angular.forEach(repeatFns, function(fn, index) {
@@ -553,7 +553,7 @@ angular.mock.$IntervalProvider = function() {
var task = repeatFns[0];
task.fn();
task.nextTime += task.delay;
- repeatFns.sort(function(a,b){ return a.nextTime - b.nextTime;});
+ repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;});
}
return millis;
};
@@ -601,7 +601,7 @@ function padNumber(num, digits, trim) {
num = -num;
}
num = '' + num;
- while(num.length < digits) num = '0' + num;
+ while (num.length < digits) num = '0' + num;
if (trim)
num = num.substr(num.length - digits);
return neg + num;
@@ -645,7 +645,7 @@ function padNumber(num, digits, trim) {
* ```
*
*/
-angular.mock.TzDate = function (offset, timestamp) {
+angular.mock.TzDate = function(offset, timestamp) {
var self = new Date(0);
if (angular.isString(timestamp)) {
var tsStr = timestamp;
@@ -788,20 +788,20 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
$provide.decorator('$animate', ['$delegate', '$$asyncCallback', '$timeout', '$browser',
function($delegate, $$asyncCallback, $timeout, $browser) {
var animate = {
- queue : [],
- cancel : $delegate.cancel,
- enabled : $delegate.enabled,
- triggerCallbackEvents : function() {
+ queue: [],
+ cancel: $delegate.cancel,
+ enabled: $delegate.enabled,
+ triggerCallbackEvents: function() {
$$asyncCallback.flush();
},
- triggerCallbackPromise : function() {
+ triggerCallbackPromise: function() {
$timeout.flush(0);
},
- triggerCallbacks : function() {
+ triggerCallbacks: function() {
this.triggerCallbackEvents();
this.triggerCallbackPromise();
},
- triggerReflow : function() {
+ triggerReflow: function() {
angular.forEach(reflowQueue, function(fn) {
fn();
});
@@ -813,10 +813,10 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
['animate','enter','leave','move','addClass','removeClass','setClass'], function(method) {
animate[method] = function() {
animate.queue.push({
- event : method,
- element : arguments[0],
- options : arguments[arguments.length-1],
- args : arguments
+ event: method,
+ element: arguments[0],
+ options: arguments[arguments.length-1],
+ args: arguments
});
return $delegate[method].apply($delegate, arguments);
};
@@ -883,13 +883,13 @@ angular.mock.dump = function(object) {
function serializeScope(scope, offset) {
offset = offset || ' ';
var log = [offset + 'Scope(' + scope.$id + '): {'];
- for ( var key in scope ) {
+ for (var key in scope) {
if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) {
log.push(' ' + key + ': ' + angular.toJson(scope[key]));
}
}
var child = scope.$$childHead;
- while(child) {
+ while (child) {
log.push(serializeScope(child, offset + ' '));
child = child.$$nextSibling;
}
@@ -1386,7 +1386,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
$httpBackend.expect = function(method, url, data, headers) {
var expectation = new MockHttpExpectation(method, url, data, headers),
chain = {
- respond: function (status, data, headers, statusText) {
+ respond: function(status, data, headers, statusText) {
expectation.response = createResponse(status, data, headers, statusText);
return chain;
}
@@ -1636,7 +1636,9 @@ function MockHttpExpectation(method, url, data, headers) {
if (angular.isUndefined(data)) return true;
if (data && angular.isFunction(data.test)) return data.test(d);
if (data && angular.isFunction(data)) return data(d);
- if (data && !angular.isString(data)) return angular.equals(data, angular.fromJson(d));
+ if (data && !angular.isString(data)) {
+ return angular.equals(angular.fromJson(angular.toJson(data)), angular.fromJson(d));
+ }
return data == d;
};
@@ -1709,7 +1711,7 @@ function MockXhr() {
* that adds a "flush" and "verifyNoPendingTasks" methods.
*/
-angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function ($delegate, $browser) {
+angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $browser) {
/**
* @ngdoc method
@@ -1763,12 +1765,12 @@ angular.mock.$RAFDecorator = ['$delegate', function($delegate) {
rafFn.supported = $delegate.supported;
rafFn.flush = function() {
- if(queue.length === 0) {
+ if (queue.length === 0) {
throw new Error('No rAF callbacks present');
}
var length = queue.length;
- for(var i=0;i<length;i++) {
+ for (var i=0;i<length;i++) {
queue[i]();
}
@@ -2036,7 +2038,7 @@ angular.mock.e2e.$httpBackendDecorator =
['$rootScope', '$delegate', '$browser', createHttpBackendMock];
-if(window.jasmine || window.mocha) {
+if (window.jasmine || window.mocha) {
var currentSpec = null,
isSpecRunning = function() {
@@ -2244,7 +2246,7 @@ if(window.jasmine || window.mocha) {
injector = currentSpec.$injector = angular.injector(modules, strictDi);
currentSpec.$injectorStrict = strictDi;
}
- for(var i = 0, ii = blockFns.length; i < ii; i++) {
+ for (var i = 0, ii = blockFns.length; i < ii; i++) {
if (currentSpec.$injectorStrict) {
// If the injector is strict / strictDi, and the spec wants to inject using automatic
// annotation, then annotate the function here.