diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-17 09:55:47 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-10-17 09:55:47 +0200 |
commit | 382a9d70e73fd4bc1039d846525f7fb16576b338 (patch) | |
tree | bae20d30f8654e090e4e8a6b12bcaaf2c99c7cde | |
parent | 17239c085117fd1cc35a1a9723d96697a1b1d268 (diff) |
update angularjs
23 files changed, 1734 insertions, 906 deletions
diff --git a/js/vendor/angular-mocks/.bower.json b/js/vendor/angular-mocks/.bower.json index b8f52aad9..e5c2af823 100644 --- a/js/vendor/angular-mocks/.bower.json +++ b/js/vendor/angular-mocks/.bower.json @@ -1,16 +1,16 @@ { "name": "angular-mocks", - "version": "1.3.0-rc.4", + "version": "1.3.0", "main": "./angular-mocks.js", "dependencies": { - "angular": "1.3.0-rc.4" + "angular": "1.3.0" }, "homepage": "https://github.com/angular/bower-angular-mocks", - "_release": "1.3.0-rc.4", + "_release": "1.3.0", "_resolution": { "type": "version", - "tag": "v1.3.0-rc.4", - "commit": "5f883d4621cafeed13a671daf295ec8df7f5a315" + "tag": "v1.3.0", + "commit": "4c8d621ebb66ccb90563767d3f4282e9682a84b7" }, "_source": "git://github.com/angular/bower-angular-mocks.git", "_target": "~1.3.*", diff --git a/js/vendor/angular-mocks/angular-mocks.js b/js/vendor/angular-mocks/angular-mocks.js index fee32da0d..ecbb22bcf 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-rc.4 + * @license AngularJS v1.3.0 * (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); } } ); @@ -151,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)) { @@ -191,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`. */ /** @@ -200,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. * * @@ -240,9 +250,8 @@ 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 @@ -333,7 +342,7 @@ angular.mock.$LogProvider = function() { * @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 @@ -347,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 @@ -361,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 @@ -375,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 @@ -389,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 @@ -405,8 +414,8 @@ 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 = []; @@ -801,11 +810,12 @@ 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], + options : arguments[arguments.length-1], args : arguments }); return $delegate[method].apply($delegate, arguments); @@ -991,6 +1001,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; @@ -1020,6 +1035,9 @@ angular.mock.dump = function(object) { describe('MyController', function() { 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'); diff --git a/js/vendor/angular-mocks/bower.json b/js/vendor/angular-mocks/bower.json index a3464f253..08e043632 100644 --- a/js/vendor/angular-mocks/bower.json +++ b/js/vendor/angular-mocks/bower.json @@ -1,8 +1,8 @@ { "name": "angular-mocks", - "version": "1.3.0-rc.4", + "version": "1.3.0", "main": "./angular-mocks.js", "dependencies": { - "angular": "1.3.0-rc.4" + "angular": "1.3.0" } } diff --git a/js/vendor/angular-mocks/package.json b/js/vendor/angular-mocks/package.json new file mode 100644 index 000000000..3f690e731 --- /dev/null +++ b/js/vendor/angular-mocks/package.json @@ -0,0 +1,27 @@ +{ + "name": "angular-mocks", + "version": "1.3.0", + "description": "AngularJS mocks for testing", + "main": "angular-mocks.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/angular/angular.js.git" + }, + "keywords": [ + "angular", + "framework", + "browser", + "mocks", + "testing", + "client-side" + ], + "author": "Angular Core Team <angular-core+npm@google.com>", + "license": "MIT", + "bugs": { + "url": "https://github.com/angular/angular.js/issues" + }, + "homepage": "http://angularjs.org" +} diff --git a/js/vendor/angular-route/.bower.json b/js/vendor/angular-route/.bower.json index 1375a6de0..617d006ac 100644 --- a/js/vendor/angular-route/.bower.json +++ b/js/vendor/angular-route/.bower.json @@ -1,16 +1,16 @@ { "name": "angular-route", - "version": "1.3.0-rc.4", + "version": "1.3.0", "main": "./angular-route.js", "dependencies": { - "angular": "1.3.0-rc.4" + "angular": "1.3.0" }, "homepage": "https://github.com/angular/bower-angular-route", - "_release": "1.3.0-rc.4", + "_release": "1.3.0", "_resolution": { "type": "version", - "tag": "v1.3.0-rc.4", - "commit": "92a994cab488c86086badeb42d579377899a8b19" + "tag": "v1.3.0", + "commit": "73a3cc8371603e22e32b6dc5354116f73b91e164" }, "_source": "git://github.com/angular/bower-angular-route.git", "_target": "~1.3.*", diff --git a/js/vendor/angular-route/angular-route.js b/js/vendor/angular-route/angular-route.js index 3d95eb529..1adbc961d 100644 --- a/js/vendor/angular-route/angular-route.js +++ b/js/vendor/angular-route/angular-route.js @@ -1,5 +1,5 @@ /** - * @license AngularJS v1.3.0-rc.4 + * @license AngularJS v1.3.0 * (c) 2010-2014 Google, Inc. http://angularjs.org * License: MIT */ @@ -380,6 +380,10 @@ function $RouteProvider(){ * defined in `resolve` route property. Once all of the dependencies are resolved * `$routeChangeSuccess` is fired. * + * The route change (and the `$location` change that triggered it) can be prevented + * by calling `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} + * for more details about event object. + * * @param {Object} angularEvent Synthetic event object. * @param {Route} next Future route information. * @param {Route} current Current route information. @@ -424,6 +428,8 @@ function $RouteProvider(){ */ var forceReload = false, + preparedRoute, + preparedRouteIsUpdateOnly, $route = { routes: routes, @@ -440,7 +446,11 @@ function $RouteProvider(){ */ reload: function() { forceReload = true; - $rootScope.$evalAsync(updateRoute); + $rootScope.$evalAsync(function() { + // Don't support cancellation of a reload for now... + prepareRoute(); + commitRoute(); + }); }, /** @@ -474,7 +484,8 @@ function $RouteProvider(){ } }; - $rootScope.$on('$locationChangeSuccess', updateRoute); + $rootScope.$on('$locationChangeStart', prepareRoute); + $rootScope.$on('$locationChangeSuccess', commitRoute); return $route; @@ -512,36 +523,50 @@ function $RouteProvider(){ return params; } - function updateRoute() { - var next = parseRoute(), - last = $route.current; - - if (next && last && next.$$route === last.$$route - && angular.equals(next.pathParams, last.pathParams) - && !next.reloadOnSearch && !forceReload) { - last.params = next.params; - angular.copy(last.params, $routeParams); - $rootScope.$broadcast('$routeUpdate', last); - } else if (next || last) { + function prepareRoute($locationEvent) { + var lastRoute = $route.current; + + preparedRoute = parseRoute(); + preparedRouteIsUpdateOnly = preparedRoute && lastRoute && preparedRoute.$$route === lastRoute.$$route + && angular.equals(preparedRoute.pathParams, lastRoute.pathParams) + && !preparedRoute.reloadOnSearch && !forceReload; + + if (!preparedRouteIsUpdateOnly && (lastRoute || preparedRoute)) { + if ($rootScope.$broadcast('$routeChangeStart', preparedRoute, lastRoute).defaultPrevented) { + if ($locationEvent) { + $locationEvent.preventDefault(); + } + } + } + } + + function commitRoute() { + var lastRoute = $route.current; + var nextRoute = preparedRoute; + + if (preparedRouteIsUpdateOnly) { + lastRoute.params = nextRoute.params; + angular.copy(lastRoute.params, $routeParams); + $rootScope.$broadcast('$routeUpdate', lastRoute); + } else if (nextRoute || lastRoute) { forceReload = false; - $rootScope.$broadcast('$routeChangeStart', next, last); - $route.current = next; - if (next) { - if (next.redirectTo) { - if (angular.isString(next.redirectTo)) { - $location.path(interpolate(next.redirectTo, next.params)).search(next.params) + $route.current = nextRoute; + if (nextRoute) { + if (nextRoute.redirectTo) { + if (angular.isString(nextRoute.redirectTo)) { + $location.path(interpolate(nextRoute.redirectTo, nextRoute.params)).search(nextRoute.params) .replace(); } else { - $location.url(next.redirectTo(next.pathParams, $location.path(), $location.search())) + $location.url(nextRoute.redirectTo(nextRoute.pathParams, $location.path(), $location.search())) .replace(); } } } - $q.when(next). + $q.when(nextRoute). then(function() { - if (next) { - var locals = angular.extend({}, next.resolve), + if (nextRoute) { + var locals = angular.extend({}, nextRoute.resolve), template, templateUrl; angular.forEach(locals, function(value, key) { @@ -549,17 +574,17 @@ function $RouteProvider(){ $injector.get(value) : $injector.invoke(value, null, null, key); }); - if (angular.isDefined(template = next.template)) { + if (angular.isDefined(template = nextRoute.template)) { if (angular.isFunction(template)) { - template = template(next.params); + template = template(nextRoute.params); } - } else if (angular.isDefined(templateUrl = next.templateUrl)) { + } else if (angular.isDefined(templateUrl = nextRoute.templateUrl)) { if (angular.isFunction(templateUrl)) { - templateUrl = templateUrl(next.params); + templateUrl = templateUrl(nextRoute.params); } templateUrl = $sce.getTrustedResourceUrl(templateUrl); if (angular.isDefined(templateUrl)) { - next.loadedTemplateUrl = templateUrl; + nextRoute.loadedTemplateUrl = templateUrl; template = $templateRequest(templateUrl); } } @@ -571,16 +596,16 @@ function $RouteProvider(){ }). // after route change then(function(locals) { - if (next == $route.current) { - if (next) { - next.locals = locals; - angular.copy(next.params, $routeParams); + if (nextRoute == $route.current) { + if (nextRoute) { + nextRoute.locals = locals; + angular.copy(nextRoute.params, $routeParams); } - $rootScope.$broadcast('$routeChangeSuccess', next, last); + $rootScope.$broadcast('$routeChangeSuccess', nextRoute, lastRoute); } }, function(error) { - if (next == $route.current) { - $rootScope.$broadcast('$routeChangeError', next, last, error); + if (nextRoute == $route.current) { + $rootScope.$broadcast('$routeChangeError', nextRoute, lastRoute, error); } }); } diff --git a/js/vendor/angular-route/angular-route.min.js b/js/vendor/angular-route/angular-route.min.js index e03c6596e..bada89b00 100644 --- a/js/vendor/angular-route/angular-route.min.js +++ b/js/vendor/angular-route/angular-route.min.js @@ -1,14 +1,15 @@ /* - AngularJS v1.3.0-rc.4 + AngularJS v1.3.0 (c) 2010-2014 Google, Inc. http://angularjs.org License: MIT */ -(function(r,d,z){'use strict';function v(s,h,f){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,e,b,g,u){function w(){l&&(f.cancel(l),l=null);k&&(k.$destroy(),k=null);q&&(l=f.leave(q),l.then(function(){l=null}),q=null)}function t(){var c=s.current&&s.current.locals;if(d.isDefined(c&&c.$template)){var c=a.$new(),m=s.current;q=u(c,function(c){f.enter(c,null,q||e).then(function(){!d.isDefined(n)||n&&!a.$eval(n)||h()});w()});k=m.scope=c;k.$emit("$viewContentLoaded"); -k.$eval(p)}else w()}var k,q,l,n=b.autoscroll,p=b.onload||"";a.$on("$routeChangeSuccess",t);t()}}}function x(d,h,f){return{restrict:"ECA",priority:-400,link:function(a,e){var b=f.current,g=b.locals;e.html(g.$template);var u=d(e.contents());b.controller&&(g.$scope=a,g=h(b.controller,g),b.controllerAs&&(a[b.controllerAs]=g),e.data("$ngControllerController",g),e.children().data("$ngControllerController",g));u(a)}}}r=d.module("ngRoute",["ng"]).provider("$route",function(){function s(a,e){return d.extend(new (d.extend(function(){}, -{prototype:a})),e)}function h(a,d){var b=d.caseInsensitiveMatch,g={originalPath:a,regexp:a},f=g.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,d,e,b){a="?"===b?b:null;b="*"===b?b:null;f.push({name:e,optional:!!a});d=d||"";return""+(a?"":d)+"(?:"+(a?d:"")+(b&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");g.regexp=new RegExp("^"+a+"$",b?"i":"");return g}var f={};this.when=function(a,e){f[a]=d.extend({reloadOnSearch:!0},e,a&&h(a,e));if(a){var b= -"/"==a[a.length-1]?a.substr(0,a.length-1):a+"/";f[b]=d.extend({redirectTo:a},h(b,e))}return this};this.otherwise=function(a){"string"===typeof a&&(a={redirectTo:a});this.when(null,a);return this};this.$get=["$rootScope","$location","$routeParams","$q","$injector","$templateRequest","$sce",function(a,e,b,g,h,r,t){function k(){var c=q(),m=p.current;if(c&&m&&c.$$route===m.$$route&&d.equals(c.pathParams,m.pathParams)&&!c.reloadOnSearch&&!n)m.params=c.params,d.copy(m.params,b),a.$broadcast("$routeUpdate", -m);else if(c||m)n=!1,a.$broadcast("$routeChangeStart",c,m),(p.current=c)&&c.redirectTo&&(d.isString(c.redirectTo)?e.path(l(c.redirectTo,c.params)).search(c.params).replace():e.url(c.redirectTo(c.pathParams,e.path(),e.search())).replace()),g.when(c).then(function(){if(c){var a=d.extend({},c.resolve),e,b;d.forEach(a,function(c,b){a[b]=d.isString(c)?h.get(c):h.invoke(c,null,null,b)});d.isDefined(e=c.template)?d.isFunction(e)&&(e=e(c.params)):d.isDefined(b=c.templateUrl)&&(d.isFunction(b)&&(b=b(c.params)), -b=t.getTrustedResourceUrl(b),d.isDefined(b)&&(c.loadedTemplateUrl=b,e=r(b)));d.isDefined(e)&&(a.$template=e);return g.all(a)}}).then(function(e){c==p.current&&(c&&(c.locals=e,d.copy(c.params,b)),a.$broadcast("$routeChangeSuccess",c,m))},function(d){c==p.current&&a.$broadcast("$routeChangeError",c,m,d)})}function q(){var c,a;d.forEach(f,function(b,g){var f;if(f=!a){var h=e.path();f=b.keys;var l={};if(b.regexp)if(h=b.regexp.exec(h)){for(var k=1,q=h.length;k<q;++k){var n=f[k-1],p=h[k];n&&p&&(l[n.name]= -p)}f=l}else f=null;else f=null;f=c=f}f&&(a=s(b,{params:d.extend({},e.search(),c),pathParams:c}),a.$$route=b)});return a||f[null]&&s(f[null],{params:{},pathParams:{}})}function l(a,b){var e=[];d.forEach((a||"").split(":"),function(a,c){if(0===c)e.push(a);else{var d=a.match(/(\w+)(.*)/),f=d[1];e.push(b[f]);e.push(d[2]||"");delete b[f]}});return e.join("")}var n=!1,p={routes:f,reload:function(){n=!0;a.$evalAsync(k)},updateParams:function(a){if(this.current&&this.current.$$route){var b={},f=this;d.forEach(Object.keys(a), -function(d){f.current.pathParams[d]||(b[d]=a[d])});a=d.extend({},this.current.params,a);e.path(l(this.current.$$route.originalPath,a));e.search(d.extend({},e.search(),b))}else throw y("norout");}};a.$on("$locationChangeSuccess",k);return p}]});var y=d.$$minErr("ngRoute");r.provider("$routeParams",function(){this.$get=function(){return{}}});r.directive("ngView",v);r.directive("ngView",x);v.$inject=["$route","$anchorScroll","$animate"];x.$inject=["$compile","$controller","$route"]})(window,window.angular); +(function(p,e,B){'use strict';function u(q,h,f){return{restrict:"ECA",terminal:!0,priority:400,transclude:"element",link:function(a,b,c,g,x){function y(){k&&(f.cancel(k),k=null);l&&(l.$destroy(),l=null);m&&(k=f.leave(m),k.then(function(){k=null}),m=null)}function w(){var c=q.current&&q.current.locals;if(e.isDefined(c&&c.$template)){var c=a.$new(),g=q.current;m=x(c,function(c){f.enter(c,null,m||b).then(function(){!e.isDefined(s)||s&&!a.$eval(s)||h()});y()});l=g.scope=c;l.$emit("$viewContentLoaded"); +l.$eval(v)}else y()}var l,m,k,s=c.autoscroll,v=c.onload||"";a.$on("$routeChangeSuccess",w);w()}}}function z(e,h,f){return{restrict:"ECA",priority:-400,link:function(a,b){var c=f.current,g=c.locals;b.html(g.$template);var x=e(b.contents());c.controller&&(g.$scope=a,g=h(c.controller,g),c.controllerAs&&(a[c.controllerAs]=g),b.data("$ngControllerController",g),b.children().data("$ngControllerController",g));x(a)}}}p=e.module("ngRoute",["ng"]).provider("$route",function(){function q(a,b){return e.extend(new (e.extend(function(){}, +{prototype:a})),b)}function h(a,e){var c=e.caseInsensitiveMatch,g={originalPath:a,regexp:a},f=g.keys=[];a=a.replace(/([().])/g,"\\$1").replace(/(\/)?:(\w+)([\?\*])?/g,function(a,e,c,b){a="?"===b?b:null;b="*"===b?b:null;f.push({name:c,optional:!!a});e=e||"";return""+(a?"":e)+"(?:"+(a?e:"")+(b&&"(.+?)"||"([^/]+)")+(a||"")+")"+(a||"")}).replace(/([\/$\*])/g,"\\$1");g.regexp=new RegExp("^"+a+"$",c?"i":"");return g}var f={};this.when=function(a,b){f[a]=e.extend({reloadOnSearch:!0},b,a&&h(a,b));if(a){var c= +"/"==a[a.len |