Skip to content

Commit 97f4f6e

Browse files
author
Adam Bradley
committed
feat(angular): Update to Angular v1.2.13, closes #600
1 parent 3d7011e commit 97f4f6e

13 files changed

+2286
-2286
lines changed

config/build.js

-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ module.exports = {
5454
'js/angular/angular-animate.min.js',
5555
'js/angular/angular-resource.js',
5656
'js/angular/angular-resource.min.js',
57-
'js/angular/angular-sanitize.js',
58-
'js/angular/angular-sanitize.min.js',
5957
'js/angular/angular.js',
6058
'js/angular/angular.min.js',
6159
'js/angular-ui/angular-ui-router.js',

config/lib/js/angular/angular-animate.js

+331-228
Large diffs are not rendered by default.

config/lib/js/angular/angular-animate.min.js

+22-20
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/lib/js/angular/angular-mocks.js

+27-56
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license AngularJS v1.2.10
2+
* @license AngularJS v1.2.13
33
* (c) 2010-2014 Google, Inc. http://angularjs.org
44
* License: MIT
55
*/
@@ -511,6 +511,7 @@ angular.mock.$IntervalProvider = function() {
511511
};
512512

513513
$interval.cancel = function(promise) {
514+
if(!promise) return false;
514515
var fnIndex;
515516

516517
angular.forEach(repeatFns, function(fn, index) {
@@ -763,70 +764,40 @@ angular.mock.TzDate = function (offset, timestamp) {
763764
angular.mock.TzDate.prototype = Date.prototype;
764765
/* jshint +W101 */
765766

766-
// TODO(matias): remove this IMMEDIATELY once we can properly detect the
767-
// presence of a registered module
768-
var animateLoaded;
769-
try {
770-
angular.module('ngAnimate');
771-
animateLoaded = true;
772-
} catch(e) {}
767+
angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
773768

774-
if(animateLoaded) {
775-
angular.module('ngAnimate').config(['$provide', function($provide) {
769+
.config(['$provide', function($provide) {
776770
var reflowQueue = [];
771+
777772
$provide.value('$$animateReflow', function(fn) {
778773
reflowQueue.push(fn);
779774
return angular.noop;
780775
});
781-
$provide.decorator('$animate', function($delegate) {
782-
$delegate.triggerReflow = function() {
783-
if(reflowQueue.length === 0) {
784-
throw new Error('No animation reflows present');
785-
}
786-
angular.forEach(reflowQueue, function(fn) {
787-
fn();
788-
});
789-
reflowQueue = [];
790-
};
791-
return $delegate;
792-
});
793-
}]);
794-
}
795-
796-
angular.mock.animate = angular.module('mock.animate', ['ng'])
797-
798-
.config(['$provide', function($provide) {
799776

800777
$provide.decorator('$animate', function($delegate) {
801778
var animate = {
802779
queue : [],
803780
enabled : $delegate.enabled,
804-
flushNext : function(name) {
805-
var tick = animate.queue.shift();
806-
807-
if (!tick) throw new Error('No animation to be flushed');
808-
if(tick.method !== name) {
809-
throw new Error('The next animation is not "' + name +
810-
'", but is "' + tick.method + '"');
781+
triggerReflow : function() {
782+
if(reflowQueue.length === 0) {
783+
throw new Error('No animation reflows present');
811784
}
812-
tick.fn();
813-
return tick;
785+
angular.forEach(reflowQueue, function(fn) {
786+
fn();
787+
});
788+
reflowQueue = [];
814789
}
815790
};
816791

817-
angular.forEach(['enter','leave','move','addClass','removeClass'], function(method) {
792+
angular.forEach(
793+
['enter','leave','move','addClass','removeClass','setClass'], function(method) {
818794
animate[method] = function() {
819-
var params = arguments;
820795
animate.queue.push({
821-
method : method,
822-
params : params,
823-
element : angular.isElement(params[0]) && params[0],
824-
parent : angular.isElement(params[1]) && params[1],
825-
after : angular.isElement(params[2]) && params[2],
826-
fn : function() {
827-
$delegate[method].apply($delegate, params);
828-
}
796+
event : method,
797+
element : arguments[0],
798+
args : arguments
829799
});
800+
$delegate[method].apply($delegate, arguments);
830801
};
831802
});
832803

@@ -996,18 +967,18 @@ angular.mock.dump = function(object) {
996967
*
997968
* # Flushing HTTP requests
998969
*
999-
* The $httpBackend used in production, always responds to requests with responses asynchronously.
1000-
* If we preserved this behavior in unit testing, we'd have to create async unit tests, which are
1001-
* hard to write, follow and maintain. At the same time the testing mock, can't respond
970+
* The $httpBackend used in production always responds to requests with responses asynchronously.
971+
* If we preserved this behavior in unit testing we'd have to create async unit tests, which are
972+
* hard to write, understand, and maintain. However, the testing mock can't respond
1002973
* synchronously because that would change the execution of the code under test. For this reason the
1003974
* mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending
1004-
* requests and thus preserving the async api of the backend, while allowing the test to execute
975+
* requests and thus preserve the async api of the backend while allowing the test to execute
1005976
* synchronously.
1006977
*
1007978
*
1008979
* # Unit testing with mock $httpBackend
1009-
* The following code shows how to setup and use the mock backend in unit testing a controller.
1010-
* First we create the controller under test
980+
* The following code shows how to setup and use the mock backend when unit testing a controller.
981+
* First we create the controller under test:
1011982
*
1012983
<pre>
1013984
// The controller code
@@ -1032,7 +1003,7 @@ angular.mock.dump = function(object) {
10321003
}
10331004
</pre>
10341005
*
1035-
* Now we setup the mock backend and create the test specs.
1006+
* Now we setup the mock backend and create the test specs:
10361007
*
10371008
<pre>
10381009
// testing controller
@@ -1954,7 +1925,7 @@ if(window.jasmine || window.mocha) {
19541925

19551926
var currentSpec = null,
19561927
isSpecRunning = function() {
1957-
return currentSpec && (window.mocha || currentSpec.queue.running);
1928+
return !!currentSpec;
19581929
};
19591930

19601931

@@ -2132,7 +2103,7 @@ if(window.jasmine || window.mocha) {
21322103
window.inject = angular.mock.inject = function() {
21332104
var blockFns = Array.prototype.slice.call(arguments, 0);
21342105
var errorForStack = new Error('Declaration Location');
2135-
return isSpecRunning() ? workFn() : workFn;
2106+
return isSpecRunning() ? workFn.call(currentSpec) : workFn;
21362107
/////////////////////
21372108
function workFn() {
21382109
var modules = currentSpec.$modules || [];

config/lib/js/angular/angular-resource.js

100644100755
+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license AngularJS v1.2.10
2+
* @license AngularJS v1.2.13
33
* (c) 2010-2014 Google, Inc. http://angularjs.org
44
* License: MIT
55
*/
@@ -40,7 +40,7 @@ function shallowClearAndCopy(src, dst) {
4040
});
4141

4242
for (var key in src) {
43-
if (src.hasOwnProperty(key) && key.charAt(0) !== '$' && key.charAt(1) !== '$') {
43+
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
4444
dst[key] = src[key];
4545
}
4646
}
@@ -392,7 +392,9 @@ angular.module('ngResource', ['ng']).
392392
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
393393
if (angular.isDefined(val) && val !== null) {
394394
encodedVal = encodeUriSegment(val);
395-
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1");
395+
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
396+
return encodedVal + p1;
397+
});
396398
} else {
397399
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
398400
leadingSlashes, tail) {

config/lib/js/angular/angular-resource.min.js

100644100755
+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)