diff --git a/xstatic/pkg/angular/__init__.py b/xstatic/pkg/angular/__init__.py
index f3983c4..f70663b 100644
--- a/xstatic/pkg/angular/__init__.py
+++ b/xstatic/pkg/angular/__init__.py
@@ -11,7 +11,7 @@ NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
# please use a all-lowercase valid python
# package name
-VERSION = '1.2.16' # version of the packaged files, please use the upstream
+VERSION = '1.3.7' # version of the packaged files, please use the upstream
# version number
BUILD = '0' # our package build number, so we can release new builds
# with fixes for xstatic stuff.
diff --git a/xstatic/pkg/angular/data/angular-animate.js b/xstatic/pkg/angular/data/angular-animate.js
index 9a0af80..7d09d78 100644
--- a/xstatic/pkg/angular/data/angular-animate.js
+++ b/xstatic/pkg/angular/data/angular-animate.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.2.16
+ * @license AngularJS v1.3.7
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -12,33 +12,31 @@
* @name ngAnimate
* @description
*
- * # ngAnimate
- *
* The `ngAnimate` module provides support for JavaScript, CSS3 transition and CSS3 keyframe animation hooks within existing core and custom directives.
*
- *
*
*
* # Usage
*
* To see animations in action, all that is required is to define the appropriate CSS classes
- * or to register a JavaScript animation via the myModule.animation() function. The directives that support animation automatically are:
+ * or to register a JavaScript animation via the `myModule.animation()` function. The directives that support animation automatically are:
* `ngRepeat`, `ngInclude`, `ngIf`, `ngSwitch`, `ngShow`, `ngHide`, `ngView` and `ngClass`. Custom directives can take advantage of animation
* by using the `$animate` service.
*
* Below is a more detailed breakdown of the supported animation events provided by pre-existing ng directives:
*
- * | Directive | Supported Animations |
- * |---------------------------------------------------------- |----------------------------------------------------|
- * | {@link ng.directive:ngRepeat#usage_animations ngRepeat} | enter, leave and move |
- * | {@link ngRoute.directive:ngView#usage_animations ngView} | enter and leave |
- * | {@link ng.directive:ngInclude#usage_animations ngInclude} | enter and leave |
- * | {@link ng.directive:ngSwitch#usage_animations ngSwitch} | enter and leave |
- * | {@link ng.directive:ngIf#usage_animations ngIf} | enter and leave |
- * | {@link ng.directive:ngClass#usage_animations ngClass} | add and remove |
- * | {@link ng.directive:ngShow#usage_animations ngShow & ngHide} | add and remove (the ng-hide class value) |
- * | {@link ng.directive:form#usage_animations form} | add and remove (dirty, pristine, valid, invalid & all other validations) |
- * | {@link ng.directive:ngModel#usage_animations ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
+ * | Directive | Supported Animations |
+ * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
+ * | {@link ng.directive:ngRepeat#animations ngRepeat} | enter, leave and move |
+ * | {@link ngRoute.directive:ngView#animations ngView} | enter and leave |
+ * | {@link ng.directive:ngInclude#animations ngInclude} | enter and leave |
+ * | {@link ng.directive:ngSwitch#animations ngSwitch} | enter and leave |
+ * | {@link ng.directive:ngIf#animations ngIf} | enter and leave |
+ * | {@link ng.directive:ngClass#animations ngClass} | add and remove (the CSS class(es) present) |
+ * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide} | add and remove (the ng-hide class value) |
+ * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel} | add and remove (dirty, pristine, valid, invalid & all other validations) |
+ * | {@link module:ngMessages#animations ngMessages} | add and remove (ng-active & ng-inactive) |
+ * | {@link module:ngMessages#animations ngMessage} | enter and leave |
*
* You can find out more information about animations upon visiting each directive page.
*
@@ -52,9 +50,9 @@
* }
*
* .slide.ng-enter { } /* starting animations for enter */
- * .slide.ng-enter-active { } /* terminal animations for enter */
+ * .slide.ng-enter.ng-enter-active { } /* terminal animations for enter */
* .slide.ng-leave { } /* starting animations for leave */
- * .slide.ng-leave-active { } /* terminal animations for leave */
+ * .slide.ng-leave.ng-leave-active { } /* terminal animations for leave */
*
*
*
+ * myField.$error = { minlength : true, required : false };
+ * ```
+ *
+ * Then the `required` message will be displayed first. When required is false then the `minlength` message
+ * will be displayed right after (since these messages are ordered this way in the template HTML code).
+ * The prioritization of each message is determined by what order they're present in the DOM.
+ * Therefore, instead of having custom JavaScript code determine the priority of what errors are
+ * present before others, the presentation of the errors are handled within the template.
+ *
+ * By default, ngMessages will only display one error at a time. However, if you wish to display all
+ * messages then the `ng-messages-multiple` attribute flag can be used on the element containing the
+ * ngMessages directive to make this happen.
+ *
+ * ```html
+ *
...
+ * ```
+ *
+ * ## Reusing and Overriding Messages
+ * In addition to prioritization, ngMessages also allows for including messages from a remote or an inline
+ * template. This allows for generic collection of messages to be reused across multiple parts of an
+ * application.
+ *
+ * ```html
+ *
+ *
+ * ```
+ *
+ * However, including generic messages may not be useful enough to match all input fields, therefore,
+ * `ngMessages` provides the ability to override messages defined in the remote template by redefining
+ * then within the directive container.
+ *
+ * ```html
+ *
+ *
+ *
+ *
+ * ```
+ *
+ * In the example HTML code above the message that is set on required will override the corresponding
+ * required message defined within the remote template. Therefore, with particular input fields (such
+ * email addresses, date fields, autocomplete inputs, etc...), specialized error messages can be applied
+ * while more generic messages can be used to handle other, more general input errors.
+ *
+ * ## Animations
+ * If the `ngAnimate` module is active within the application then both the `ngMessages` and
+ * `ngMessage` directives will trigger animations whenever any messages are added and removed
+ * from the DOM by the `ngMessages` directive.
+ *
+ * Whenever the `ngMessages` directive contains one or more visible messages then the `.ng-active` CSS
+ * class will be added to the element. The `.ng-inactive` CSS class will be applied when there are no
+ * animations present. Therefore, CSS transitions and keyframes as well as JavaScript animations can
+ * hook into the animations whenever these classes are added/removed.
+ *
+ * Let's say that our HTML code for our messages container looks like so:
+ *
+ * ```html
+ *
+ *
...
+ *
...
+ *
+ * ```
+ *
+ * Then the CSS animation code for the message container looks like so:
+ *
+ * ```css
+ * .my-messages {
+ * transition:1s linear all;
+ * }
+ * .my-messages.ng-active {
+ * // messages are visible
+ * }
+ * .my-messages.ng-inactive {
+ * // messages are hidden
+ * }
+ * ```
+ *
+ * Whenever an inner message is attached (becomes visible) or removed (becomes hidden) then the enter
+ * and leave animation is triggered for each particular element bound to the `ngMessage` directive.
+ *
+ * Therefore, the CSS code for the inner messages looks like so:
+ *
+ * ```css
+ * .some-message {
+ * transition:1s linear all;
+ * }
+ *
+ * .some-message.ng-enter {}
+ * .some-message.ng-enter.ng-enter-active {}
+ *
+ * .some-message.ng-leave {}
+ * .some-message.ng-leave.ng-leave-active {}
+ * ```
+ *
+ * {@link ngAnimate Click here} to learn how to use JavaScript animations or to learn more about ngAnimate.
+ */
+angular.module('ngMessages', [])
+
+ /**
+ * @ngdoc directive
+ * @module ngMessages
+ * @name ngMessages
+ * @restrict AE
+ *
+ * @description
+ * `ngMessages` is a directive that is designed to show and hide messages based on the state
+ * of a key/value object that it listens on. The directive itself compliments error message
+ * reporting with the `ngModel` $error object (which stores a key/value state of validation errors).
+ *
+ * `ngMessages` manages the state of internal messages within its container element. The internal
+ * messages use the `ngMessage` directive and will be inserted/removed from the page depending
+ * on if they're present within the key/value object. By default, only one message will be displayed
+ * at a time and this depends on the prioritization of the messages within the template. (This can
+ * be changed by using the ng-messages-multiple on the directive container.)
+ *
+ * A remote template can also be used to promote message reuseability and messages can also be
+ * overridden.
+ *
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
+ *
+ * @usage
+ * ```html
+ *
+ *
+ * ...
+ * ...
+ * ...
+ *
+ *
+ *
+ *
+ * ...
+ * ...
+ * ...
+ *
+ * ```
+ *
+ * @param {string} ngMessages an angular expression evaluating to a key/value object
+ * (this is typically the $error object on an ngModel instance).
+ * @param {string=} ngMessagesMultiple|multiple when set, all messages will be displayed with true
+ * @param {string=} ngMessagesInclude|include when set, the specified template will be included into the ng-messages container
+ *
+ * @example
+ *
+ *
+ *
+ *
+ *
+ * angular.module('ngMessagesExample', ['ngMessages']);
+ *
+ *
+ */
+ .directive('ngMessages', ['$compile', '$animate', '$templateRequest',
+ function($compile, $animate, $templateRequest) {
+ var ACTIVE_CLASS = 'ng-active';
+ var INACTIVE_CLASS = 'ng-inactive';
+
+ return {
+ restrict: 'AE',
+ controller: function() {
+ this.$renderNgMessageClasses = angular.noop;
+
+ var messages = [];
+ this.registerMessage = function(index, message) {
+ for (var i = 0; i < messages.length; i++) {
+ if (messages[i].type == message.type) {
+ if (index != i) {
+ var temp = messages[index];
+ messages[index] = messages[i];
+ if (index < messages.length) {
+ messages[i] = temp;
+ } else {
+ messages.splice(0, i); //remove the old one (and shift left)
+ }
+ }
+ return;
+ }
+ }
+ messages.splice(index, 0, message); //add the new one (and shift right)
+ };
+
+ this.renderMessages = function(values, multiple) {
+ values = values || {};
+
+ var found;
+ angular.forEach(messages, function(message) {
+ if ((!found || multiple) && truthyVal(values[message.type])) {
+ message.attach();
+ found = true;
+ } else {
+ message.detach();
+ }
+ });
+
+ this.renderElementClasses(found);
+
+ function truthyVal(value) {
+ return value !== null && value !== false && value;
+ }
+ };
+ },
+ require: 'ngMessages',
+ link: function($scope, element, $attrs, ctrl) {
+ ctrl.renderElementClasses = function(bool) {
+ bool ? $animate.setClass(element, ACTIVE_CLASS, INACTIVE_CLASS)
+ : $animate.setClass(element, INACTIVE_CLASS, ACTIVE_CLASS);
+ };
+
+ //JavaScript treats empty strings as false, but ng-message-multiple by itself is an empty string
+ var multiple = angular.isString($attrs.ngMessagesMultiple) ||
+ angular.isString($attrs.multiple);
+
+ var cachedValues, watchAttr = $attrs.ngMessages || $attrs['for']; //for is a reserved keyword
+ $scope.$watchCollection(watchAttr, function(values) {
+ cachedValues = values;
+ ctrl.renderMessages(values, multiple);
+ });
+
+ var tpl = $attrs.ngMessagesInclude || $attrs.include;
+ if (tpl) {
+ $templateRequest(tpl)
+ .then(function processTemplate(html) {
+ var after, container = angular.element('').html(html);
+ angular.forEach(container.children(), function(elm) {
+ elm = angular.element(elm);
+ after ? after.after(elm)
+ : element.prepend(elm); //start of the container
+ after = elm;
+ $compile(elm)($scope);
+ });
+ ctrl.renderMessages(cachedValues, multiple);
+ });
+ }
+ }
+ };
+ }])
+
+
+ /**
+ * @ngdoc directive
+ * @name ngMessage
+ * @restrict AE
+ * @scope
+ *
+ * @description
+ * `ngMessage` is a directive with the purpose to show and hide a particular message.
+ * For `ngMessage` to operate, a parent `ngMessages` directive on a parent DOM element
+ * must be situated since it determines which messages are visible based on the state
+ * of the provided key/value map that `ngMessages` listens on.
+ *
+ * @usage
+ * ```html
+ *
+ *
+ * ...
+ * ...
+ * ...
+ *
+ *
+ *
+ *
+ * ...
+ * ...
+ * ...
+ *
+ * ```
+ *
+ * {@link module:ngMessages Click here} to learn more about `ngMessages` and `ngMessage`.
+ *
+ * @param {string} ngMessage a string value corresponding to the message key.
+ */
+ .directive('ngMessage', ['$animate', function($animate) {
+ var COMMENT_NODE = 8;
+ return {
+ require: '^ngMessages',
+ transclude: 'element',
+ terminal: true,
+ restrict: 'AE',
+ link: function($scope, $element, $attrs, ngMessages, $transclude) {
+ var index, element;
+
+ var commentNode = $element[0];
+ var parentNode = commentNode.parentNode;
+ for (var i = 0, j = 0; i < parentNode.childNodes.length; i++) {
+ var node = parentNode.childNodes[i];
+ if (node.nodeType == COMMENT_NODE && node.nodeValue.indexOf('ngMessage') >= 0) {
+ if (node === commentNode) {
+ index = j;
+ break;
+ }
+ j++;
+ }
+ }
+
+ ngMessages.registerMessage(index, {
+ type: $attrs.ngMessage || $attrs.when,
+ attach: function() {
+ if (!element) {
+ $transclude($scope, function(clone) {
+ $animate.enter(clone, null, $element);
+ element = clone;
+ });
+ }
+ },
+ detach: function(now) {
+ if (element) {
+ $animate.leave(element);
+ element = null;
+ }
+ }
+ });
+ }
+ };
+ }]);
+
+
+})(window, window.angular);
diff --git a/xstatic/pkg/angular/data/angular-mocks.js b/xstatic/pkg/angular/data/angular-mocks.js
index da804b4..3430bb7 100644
--- a/xstatic/pkg/angular/data/angular-mocks.js
+++ b/xstatic/pkg/angular/data/angular-mocks.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.2.16
+ * @license AngularJS v1.3.7
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -53,9 +53,10 @@ angular.mock.$Browser = function() {
self.onUrlChange = function(listener) {
self.pollFns.push(
function() {
- if (self.$$lastUrl != self.$$url) {
+ if (self.$$lastUrl !== self.$$url || self.$$state !== self.$$lastState) {
self.$$lastUrl = self.$$url;
- listener(self.$$url);
+ self.$$lastState = self.$$state;
+ listener(self.$$url, self.$$state);
}
}
);
@@ -63,6 +64,8 @@ angular.mock.$Browser = function() {
return listener;
};
+ self.$$checkUrlChange = angular.noop;
+
self.cookieHash = {};
self.lastCookieHash = {};
self.deferredFns = [];
@@ -71,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++;
};
@@ -114,7 +117,7 @@ angular.mock.$Browser = function() {
self.defer.now += delay;
} else {
if (self.deferredFns.length) {
- self.defer.now = self.deferredFns[self.deferredFns.length-1].time;
+ self.defer.now = self.deferredFns[self.deferredFns.length - 1].time;
} else {
throw new Error('No deferred tasks to be flushed');
}
@@ -125,7 +128,7 @@ angular.mock.$Browser = function() {
}
};
- self.$$baseHref = '';
+ self.$$baseHref = '/';
self.baseHref = function() {
return this.$$baseHref;
};
@@ -139,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();
});
},
@@ -149,15 +152,24 @@ angular.mock.$Browser.prototype = {
return pollFn;
},
- url: function(url, replace) {
+ url: function(url, replace, state) {
+ if (angular.isUndefined(state)) {
+ state = null;
+ }
if (url) {
this.$$url = url;
+ // Native pushState serializes & copies the object; simulate it.
+ this.$$state = angular.copy(state);
return this;
}
return this.$$url;
},
+ state: function() {
+ return this.$$state;
+ },
+
cookies: function(name, value) {
if (name) {
if (angular.isUndefined(value)) {
@@ -189,7 +201,7 @@ angular.mock.$Browser.prototype = {
*
* @description
* Configures the mock implementation of {@link ng.$exceptionHandler} to rethrow or to log errors
- * passed into the `$exceptionHandler`.
+ * passed to the `$exceptionHandler`.
*/
/**
@@ -198,7 +210,7 @@ angular.mock.$Browser.prototype = {
*
* @description
* Mock implementation of {@link ng.$exceptionHandler} that rethrows or logs errors passed
- * into it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration
+ * to it. See {@link ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration
* information.
*
*
@@ -238,16 +250,15 @@ angular.mock.$ExceptionHandlerProvider = function() {
*
* @param {string} mode Mode of operation, defaults to `rethrow`.
*
- * - `rethrow`: If any errors are passed into the handler in tests, it typically
- * means that there is a bug in the application or test, so this mock will
- * make these tests fail.
+ * - `rethrow`: If any errors are passed to the handler in tests, it typically means that there
+ * is a bug in the application or test, so this mock will make these tests fail.
* - `log`: Sometimes it is desirable to test that an error is thrown, for this case the `log`
* mode stores an array of errors in `$exceptionHandler.errors`, to allow later
* assertion of them. See {@link ngMock.$log#assertEmpty assertEmpty()} and
* {@link ngMock.$log#reset reset()}
*/
this.mode = function(mode) {
- switch(mode) {
+ switch (mode) {
case 'rethrow':
handler = function(e) {
throw e;
@@ -305,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)); },
@@ -325,13 +336,13 @@ 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
*
* @description
- * Array of messages logged using {@link ngMock.$log#log}.
+ * Array of messages logged using {@link ng.$log#log `log()`}.
*
* @example
* ```js
@@ -345,7 +356,7 @@ angular.mock.$LogProvider = function() {
* @name $log#info.logs
*
* @description
- * Array of messages logged using {@link ngMock.$log#info}.
+ * Array of messages logged using {@link ng.$log#info `info()`}.
*
* @example
* ```js
@@ -359,7 +370,7 @@ angular.mock.$LogProvider = function() {
* @name $log#warn.logs
*
* @description
- * Array of messages logged using {@link ngMock.$log#warn}.
+ * Array of messages logged using {@link ng.$log#warn `warn()`}.
*
* @example
* ```js
@@ -373,7 +384,7 @@ angular.mock.$LogProvider = function() {
* @name $log#error.logs
*
* @description
- * Array of messages logged using {@link ngMock.$log#error}.
+ * Array of messages logged using {@link ng.$log#error `error()`}.
*
* @example
* ```js
@@ -387,7 +398,7 @@ angular.mock.$LogProvider = function() {
* @name $log#debug.logs
*
* @description
- * Array of messages logged using {@link ngMock.$log#debug}.
+ * Array of messages logged using {@link ng.$log#debug `debug()`}.
*
* @example
* ```js
@@ -403,21 +414,21 @@ angular.mock.$LogProvider = function() {
* @name $log#assertEmpty
*
* @description
- * Assert that the all of the logging methods have no logged messages. If messages present, an
- * exception is thrown.
+ * Assert that all of the logging methods have no logged messages. If any messages are present,
+ * an exception is thrown.
*/
$log.assertEmpty = 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 || ''));
});
});
});
if (errors.length) {
- errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or "+
+ errors.unshift("Expected $log to be empty! Either a message was logged unexpectedly, or " +
"an expected log message was not checked and removed:");
errors.push('');
throw new Error(errors.join('\n---------\n'));
@@ -450,19 +461,19 @@ angular.mock.$LogProvider = function() {
* @returns {promise} A promise which will be notified on each iteration.
*/
angular.mock.$IntervalProvider = function() {
- this.$get = ['$rootScope', '$q',
- function($rootScope, $q) {
+ this.$get = ['$browser', '$rootScope', '$q', '$$q',
+ function($browser, $rootScope, $q, $$q) {
var repeatFns = [],
nextRepeatId = 0,
now = 0;
var $interval = function(fn, delay, count, invokeApply) {
- var deferred = $q.defer(),
- promise = deferred.promise,
- iteration = 0,
- skipApply = (angular.isDefined(invokeApply) && !invokeApply);
+ var iteration = 0,
+ skipApply = (angular.isDefined(invokeApply) && !invokeApply),
+ deferred = (skipApply ? $$q : $q).defer(),
+ promise = deferred.promise;
- count = (angular.isDefined(count)) ? count : 0,
+ count = (angular.isDefined(count)) ? count : 0;
promise.then(null, null, fn);
promise.$$intervalId = nextRepeatId;
@@ -483,7 +494,11 @@ angular.mock.$IntervalProvider = function() {
}
}
- if (!skipApply) $rootScope.$apply();
+ if (skipApply) {
+ $browser.defer.flush();
+ } else {
+ $rootScope.$apply();
+ }
}
repeatFns.push({
@@ -493,7 +508,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;
@@ -509,7 +524,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) {
@@ -542,7 +557,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;
};
@@ -570,10 +585,10 @@ function jsonStringToDate(string) {
tzMin = int(match[9] + match[11]);
}
date.setUTCFullYear(int(match[1]), int(match[2]) - 1, int(match[3]));
- date.setUTCHours(int(match[4]||0) - tzHour,
- int(match[5]||0) - tzMin,
- int(match[6]||0),
- int(match[7]||0));
+ date.setUTCHours(int(match[4] || 0) - tzHour,
+ int(match[5] || 0) - tzMin,
+ int(match[6] || 0),
+ int(match[7] || 0));
return date;
}
return string;
@@ -590,7 +605,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;
@@ -634,7 +649,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;
@@ -652,7 +667,7 @@ angular.mock.TzDate = function (offset, timestamp) {
}
var localOffset = new Date(timestamp).getTimezoneOffset();
- self.offsetDiff = localOffset*60*1000 - offset*1000*60*60;
+ self.offsetDiff = localOffset * 60 * 1000 - offset * 1000 * 60 * 60;
self.date = new Date(timestamp + self.offsetDiff);
self.getTime = function() {
@@ -774,14 +789,23 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
};
});
- $provide.decorator('$animate', function($delegate, $$asyncCallback) {
+ $provide.decorator('$animate', ['$delegate', '$$asyncCallback', '$timeout', '$browser',
+ function($delegate, $$asyncCallback, $timeout, $browser) {
var animate = {
- queue : [],
- enabled : $delegate.enabled,
- triggerCallbacks : function() {
+ queue: [],
+ cancel: $delegate.cancel,
+ enabled: $delegate.enabled,
+ triggerCallbackEvents: function() {
$$asyncCallback.flush();
},
- triggerReflow : function() {
+ triggerCallbackPromise: function() {
+ $timeout.flush(0);
+ },
+ triggerCallbacks: function() {
+ this.triggerCallbackEvents();
+ this.triggerCallbackPromise();
+ },
+ triggerReflow: function() {
angular.forEach(reflowQueue, function(fn) {
fn();
});
@@ -790,19 +814,20 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
};
angular.forEach(
- ['enter','leave','move','addClass','removeClass','setClass'], function(method) {
+ ['animate','enter','leave','move','addClass','removeClass','setClass'], function(method) {
animate[method] = function() {
animate.queue.push({
- event : method,
- element : arguments[0],
- args : arguments
+ event: method,
+ element: arguments[0],
+ options: arguments[arguments.length - 1],
+ args: arguments
});
- $delegate[method].apply($delegate, arguments);
+ return $delegate[method].apply($delegate, arguments);
};
});
return animate;
- });
+ }]);
}]);
@@ -862,13 +887,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;
}
@@ -900,7 +925,7 @@ angular.mock.dump = function(object) {
* When an Angular application needs some data from a server, it calls the $http service, which
* sends the request to a real server using $httpBackend service. With dependency injection, it is
* easy to inject $httpBackend mock (which has the same API as $httpBackend) and use it to verify
- * the requests and respond with some testing data without sending a request to real server.
+ * the requests and respond with some testing data without sending a request to a real server.
*
* There are two ways to specify what test data should be returned as http responses by the mock
* backend when the code under test makes http requests:
@@ -980,6 +1005,11 @@ angular.mock.dump = function(object) {
* First we create the controller under test:
*
```js
+ // The module code
+ angular
+ .module('MyApp', [])
+ .controller('MyController', MyController);
+
// The controller code
function MyController($scope, $http) {
var authToken;
@@ -1007,13 +1037,17 @@ angular.mock.dump = function(object) {
```js
// testing controller
describe('MyController', function() {
- var $httpBackend, $rootScope, createController;
+ var $httpBackend, $rootScope, createController, authRequestHandler;
+
+ // Set up the module
+ beforeEach(module('MyApp'));
beforeEach(inject(function($injector) {
// Set up the mock http service responses
$httpBackend = $injector.get('$httpBackend');
// backend definition common for all tests
- $httpBackend.when('GET', '/auth.py').respond({userId: 'userX'}, {'A-Token': 'xxx'});
+ authRequestHandler = $httpBackend.when('GET', '/auth.py')
+ .respond({userId: 'userX'}, {'A-Token': 'xxx'});
// Get hold of a scope (i.e. the root scope)
$rootScope = $injector.get('$rootScope');
@@ -1039,6 +1073,18 @@ angular.mock.dump = function(object) {
});
+ it('should fail authentication', function() {
+
+ // Notice how you can change the response even after it was set
+ authRequestHandler.respond(401, '');
+
+ $httpBackend.expectGET('/auth.py');
+ var controller = createController();
+ $httpBackend.flush();
+ expect($rootScope.status).toBe('Failed...');
+ });
+
+
it('should send msg to server', function() {
var controller = createController();
$httpBackend.flush();
@@ -1073,7 +1119,7 @@ angular.mock.dump = function(object) {
```
*/
angular.mock.$HttpBackendProvider = function() {
- this.$get = ['$rootScope', createHttpBackendMock];
+ this.$get = ['$rootScope', '$timeout', createHttpBackendMock];
};
/**
@@ -1090,7 +1136,7 @@ angular.mock.$HttpBackendProvider = function() {
* @param {Object=} $browser Auto-flushing enabled if specified
* @return {Object} Instance of $httpBackend mock
*/
-function createHttpBackendMock($rootScope, $delegate, $browser) {
+function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
var definitions = [],
expectations = [],
responses = [],
@@ -1103,7 +1149,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
return function() {
return angular.isNumber(status)
? [status, data, headers, statusText]
- : [200, status, data];
+ : [200, status, data, headers];
};
}
@@ -1120,7 +1166,9 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
}
function wrapResponse(wrapped) {
- if (!$browser && timeout && timeout.then) timeout.then(handleTimeout);
+ if (!$browser && timeout) {
+ timeout.then ? timeout.then(handleTimeout) : $timeout(handleTimeout, timeout);
+ }
return handleResponse;
@@ -1186,32 +1234,39 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* Creates a new backend definition.
*
* @param {string} method HTTP method.
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
* data string and returns true if the data is as expected.
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
* object and returns true if the headers match the current definition.
* @returns {requestHandler} Returns an object with `respond` method that controls how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*
* - respond –
* `{function([status,] data[, headers, statusText])
* | function(function(method, url, data, headers)}`
* – The respond method takes a set of static data to be returned or a function that can
* return an array containing response status (number), response data (string), response
- * headers (Object), and the text for the status (string).
+ * headers (Object), and the text for the status (string). The respond method returns the
+ * `requestHandler` object for possible overrides.
*/
$httpBackend.when = function(method, url, data, headers) {
var definition = new MockHttpExpectation(method, url, data, headers),
chain = {
respond: function(status, data, headers, statusText) {
+ definition.passThrough = undefined;
definition.response = createResponse(status, data, headers, statusText);
+ return chain;
}
};
if ($browser) {
chain.passThrough = function() {
+ definition.response = undefined;
definition.passThrough = true;
+ return chain;
};
}
@@ -1225,10 +1280,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new backend definition for GET requests. For more info see `when()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(Object|function(Object))=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1237,10 +1294,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new backend definition for HEAD requests. For more info see `when()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(Object|function(Object))=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1249,10 +1308,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new backend definition for DELETE requests. For more info see `when()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(Object|function(Object))=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1261,12 +1322,14 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new backend definition for POST requests. For more info see `when()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
* data string and returns true if the data is as expected.
* @param {(Object|function(Object))=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1275,12 +1338,14 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new backend definition for PUT requests. For more info see `when()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string))=} data HTTP request body or function that receives
* data string and returns true if the data is as expected.
* @param {(Object|function(Object))=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1289,9 +1354,11 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new backend definition for JSONP requests. For more info see `when()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
createShortMethods('when');
@@ -1303,30 +1370,36 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* Creates a new request expectation.
*
* @param {string} method HTTP method.
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
* receives data string and returns true if the data is as expected, or Object if request body
* is in JSON format.
* @param {(Object|function(Object))=} headers HTTP headers or function that receives http header
* object and returns true if the headers match the current expectation.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*
* - respond –
* `{function([status,] data[, headers, statusText])
* | function(function(method, url, data, headers)}`
* – The respond method takes a set of static data to be returned or a function that can
* return an array containing response status (number), response data (string), response
- * headers (Object), and the text for the status (string).
+ * headers (Object), and the text for the status (string). The respond method returns the
+ * `requestHandler` object for possible overrides.
*/
$httpBackend.expect = function(method, url, data, headers) {
- var expectation = new MockHttpExpectation(method, url, data, headers);
+ var expectation = new MockHttpExpectation(method, url, data, headers),
+ chain = {
+ respond: function(status, data, headers, statusText) {
+ expectation.response = createResponse(status, data, headers, statusText);
+ return chain;
+ }
+ };
+
expectations.push(expectation);
- return {
- respond: function (status, data, headers, statusText) {
- expectation.response = createResponse(status, data, headers, statusText);
- }
- };
+ return chain;
};
@@ -1336,10 +1409,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for GET requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {Object=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled. See #expect for more info.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled. See #expect for more info.
*/
/**
@@ -1348,10 +1423,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for HEAD requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {Object=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1360,10 +1437,12 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for DELETE requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {Object=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1372,13 +1451,15 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for POST requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
* receives data string and returns true if the data is as expected, or Object if request body
* is in JSON format.
* @param {Object=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1387,13 +1468,15 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for PUT requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
* receives data string and returns true if the data is as expected, or Object if request body
* is in JSON format.
* @param {Object=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1402,13 +1485,15 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for PATCH requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @param {(string|RegExp|function(string)|Object)=} data HTTP request body or function that
* receives data string and returns true if the data is as expected, or Object if request body
* is in JSON format.
* @param {Object=} headers HTTP headers.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
/**
@@ -1417,9 +1502,11 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* @description
* Creates a new request expectation for JSONP requests. For more info see `expect()`.
*
- * @param {string|RegExp} url HTTP url.
+ * @param {string|RegExp|function(string)} url HTTP url or function that receives the url
+ * and returns true if the url match the current definition.
* @returns {requestHandler} Returns an object with `respond` method that control how a matched
- * request is handled.
+ * request is handled. You can save this object for later use and invoke `respond` again in
+ * order to change how a matched request is handled.
*/
createShortMethods('expect');
@@ -1434,11 +1521,11 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* all pending requests will be flushed. If there are no pending requests when the flush method
* is called an exception is thrown (as this typically a sign of programming error).
*/
- $httpBackend.flush = function(count) {
- $rootScope.$digest();
+ $httpBackend.flush = function(count, digest) {
+ if (digest !== false) $rootScope.$digest();
if (!responses.length) throw new Error('No pending request to flush !');
- if (angular.isDefined(count)) {
+ if (angular.isDefined(count) && count !== null) {
while (count--) {
if (!responses.length) throw new Error('No more pending request to flush !');
responses.shift()();
@@ -1448,7 +1535,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
responses.shift()();
}
}
- $httpBackend.verifyNoOutstandingExpectation();
+ $httpBackend.verifyNoOutstandingExpectation(digest);
};
@@ -1466,8 +1553,8 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
* afterEach($httpBackend.verifyNoOutstandingExpectation);
* ```
*/
- $httpBackend.verifyNoOutstandingExpectation = function() {
- $rootScope.$digest();
+ $httpBackend.verifyNoOutstandingExpectation = function(digest) {
+ if (digest !== false) $rootScope.$digest();
if (expectations.length) {
throw new Error('Unsatisfied requests: ' + expectations.join(', '));
}
@@ -1511,7 +1598,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) {
function createShortMethods(prefix) {
- angular.forEach(['GET', 'DELETE', 'JSONP'], function(method) {
+ angular.forEach(['GET', 'DELETE', 'JSONP', 'HEAD'], function(method) {
$httpBackend[prefix + method] = function(url, headers) {
return $httpBackend[prefix](method, url, undefined, headers);
};
@@ -1541,6 +1628,7 @@ function MockHttpExpectation(method, url, data, headers) {
this.matchUrl = function(u) {
if (!url) return true;
if (angular.isFunction(url.test)) return url.test(u);
+ if (angular.isFunction(url)) return url(u);
return url == u;
};
@@ -1554,7 +1642,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;
};
@@ -1627,7 +1717,7 @@ function MockXhr() {
* that adds a "flush" and "verifyNoPendingTasks" methods.
*/
-angular.mock.$TimeoutDecorator = function($delegate, $browser) {
+angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $browser) {
/**
* @ngdoc method
@@ -1666,9 +1756,9 @@ angular.mock.$TimeoutDecorator = function($delegate, $browser) {
}
return $delegate;
-};
+}];
-angular.mock.$RAFDecorator = function($delegate) {
+angular.mock.$RAFDecorator = ['$delegate', function($delegate) {
var queue = [];
var rafFn = function(fn) {
var index = queue.length;
@@ -1681,12 +1771,12 @@ angular.mock.$RAFDecorator = 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
+ * *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
*
* This function registers a module configuration code. It collects the configuration information
* which will be used when the injector is created by {@link angular.mock.inject inject}.
@@ -2002,7 +2190,7 @@ if(window.jasmine || window.mocha) {
* @param {...(string|Function|Object)} fns any number of modules which are represented as string
* aliases or as anonymous module initialization functions. The modules are used to
* configure the injector. The 'ng' and 'ngMock' modules are automatically loaded. If an
- * object literal is passed they will be register as values in the module, the key being
+ * object literal is passed they will be registered as values in the module, the key being
* the module name and the value being what is returned.
*/
window.module = angular.mock.module = function() {
@@ -2035,6 +2223,7 @@ if(window.jasmine || window.mocha) {
* @description
*
* *NOTE*: This function is also published on window for easy access.
+ * *NOTE*: This function is declared ONLY WHEN running tests with jasmine or mocha
*
* The inject function wraps a function into an injectable function. The inject() creates new
* instance of {@link auto.$injector $injector} per test, which is then used for
@@ -2134,14 +2323,28 @@ if(window.jasmine || window.mocha) {
/////////////////////
function workFn() {
var modules = currentSpec.$modules || [];
-
+ var strictDi = !!currentSpec.$injectorStrict;
modules.unshift('ngMock');
modules.unshift('ng');
var injector = currentSpec.$injector;
if (!injector) {
- injector = currentSpec.$injector = angular.injector(modules);
+ if (strictDi) {
+ // If strictDi is enabled, annotate the providerInjector blocks
+ angular.forEach(modules, function(moduleFn) {
+ if (typeof moduleFn === "function") {
+ angular.injector.$$annotate(moduleFn);
+ }
+ });
+ }
+ 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.
+ injector.annotate(blockFns[i]);
+ }
try {
/* jshint -W040 *//* Jasmine explicitly provides a `this` object when calling functions */
injector.invoke(blockFns[i] || angular.noop, this);
@@ -2157,6 +2360,22 @@ if(window.jasmine || window.mocha) {
}
}
};
+
+
+ angular.mock.inject.strictDi = function(value) {
+ value = arguments.length ? !!value : true;
+ return isSpecRunning() ? workFn() : workFn;
+
+ function workFn() {
+ if (value !== currentSpec.$injectorStrict) {
+ if (currentSpec.$injector) {
+ throw new Error('Injector already created, can not modify strict annotations');
+ } else {
+ currentSpec.$injectorStrict = value;
+ }
+ }
+ }
+ };
}
diff --git a/xstatic/pkg/angular/data/angular-resource.js b/xstatic/pkg/angular/data/angular-resource.js
index 7014984..7a5eac2 100644
--- a/xstatic/pkg/angular/data/angular-resource.js
+++ b/xstatic/pkg/angular/data/angular-resource.js
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.2.16
+ * @license AngularJS v1.3.7
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -35,7 +35,7 @@ function lookupDottedPath(obj, path) {
function shallowClearAndCopy(src, dst) {
dst = dst || {};
- angular.forEach(dst, function(value, key){
+ angular.forEach(dst, function(value, key) {
delete dst[key];
});
@@ -78,6 +78,18 @@ function shallowClearAndCopy(src, dst) {
*
* Requires the {@link ngResource `ngResource`} module to be installed.
*
+ * By default, trailing slashes will be stripped from the calculated URLs,
+ * which can pose problems with server backends that do not expect that
+ * behavior. This can be disabled by configuring the `$resourceProvider` like
+ * this:
+ *
+ * ```js
+ app.config(['$resourceProvider', function($resourceProvider) {
+ // Don't strip trailing slashes from calculated URLs
+ $resourceProvider.defaults.stripTrailingSlashes = false;
+ }]);
+ * ```
+ *
* @param {string} url A parametrized URL template with parameters prefixed by `:` as in
* `/user/:username`. If you are using a URL with a port number (e.g.
* `http://example.com:8080/api`), it will be respected.
@@ -99,12 +111,14 @@ function shallowClearAndCopy(src, dst) {
* Given a template `/path/:verb` and parameter `{verb:'greet', salutation:'Hello'}` results in
* URL `/path/greet?salutation=Hello`.
*
- * If the parameter value is prefixed with `@` then the value of that parameter is extracted from
- * the data object (useful for non-GET operations).
+ * If the parameter value is prefixed with `@` then the value for that parameter will be extracted
+ * from the corresponding property on the `data` object (provided when calling an action method). For
+ * example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of `someParam`
+ * will be `data.someProp`.
*
- * @param {Object.