vendor/assets/javascripts/angular-mocks.js in angularjs-rails-1.2.0.rc1 vs vendor/assets/javascripts/angular-mocks.js in angularjs-rails-1.2.0.rc2
- old
+ new
@@ -1,7 +1,7 @@
/**
- * @license AngularJS v1.2.0rc1
+ * @license AngularJS v1.2.0-rc.2
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*
* TODO(vojta): wrap whole file into closure during build
*/
@@ -314,11 +314,11 @@
function concat(array1, array2, index) {
return array1.concat(Array.prototype.slice.call(array2, index));
}
this.debugEnabled = function(flag) {
- if (isDefined(flag)) {
+ if (angular.isDefined(flag)) {
debug = flag;
return this;
} else {
return debug;
}
@@ -1849,13 +1849,15 @@
* 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}.
*
* See {@link angular.mock.inject inject} for usage example
*
- * @param {...(string|Function)} fns any number of modules which are represented as string
+ * @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.
+ * 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
+ * the module name and the value being what is returned.
*/
window.module = angular.mock.module = function() {
var moduleFns = Array.prototype.slice.call(arguments, 0);
return isSpecRunning() ? workFn() : workFn;
/////////////////////
@@ -1863,10 +1865,18 @@
if (currentSpec.$injector) {
throw Error('Injector already created, can not register a module!');
} else {
var modules = currentSpec.$modules || (currentSpec.$modules = []);
angular.forEach(moduleFns, function(module) {
- modules.push(module);
+ if (angular.isObject(module) && !angular.isArray(module)) {
+ modules.push(function($provide) {
+ angular.forEach(module, function(value, key) {
+ $provide.value(key, value);
+ });
+ });
+ } else {
+ modules.push(module);
+ }
});
}
}
};