Skip to content

Commit

Permalink
feat(angular): Update to Angular v1.2.13, closes #600
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Bradley committed Feb 17, 2014
1 parent 3d7011e commit 97f4f6e
Show file tree
Hide file tree
Showing 13 changed files with 2,286 additions and 2,286 deletions.
2 changes: 0 additions & 2 deletions config/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ module.exports = {
'js/angular/angular-animate.min.js',
'js/angular/angular-resource.js',
'js/angular/angular-resource.min.js',
'js/angular/angular-sanitize.js',
'js/angular/angular-sanitize.min.js',
'js/angular/angular.js',
'js/angular/angular.min.js',
'js/angular-ui/angular-ui-router.js',
Expand Down
559 changes: 331 additions & 228 deletions config/lib/js/angular/angular-animate.js

Large diffs are not rendered by default.

42 changes: 22 additions & 20 deletions config/lib/js/angular/angular-animate.min.js

Large diffs are not rendered by default.

83 changes: 27 additions & 56 deletions config/lib/js/angular/angular-mocks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license AngularJS v1.2.10
* @license AngularJS v1.2.13
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
Expand Down Expand Up @@ -511,6 +511,7 @@ angular.mock.$IntervalProvider = function() {
};

$interval.cancel = function(promise) {
if(!promise) return false;
var fnIndex;

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

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

if(animateLoaded) {
angular.module('ngAnimate').config(['$provide', function($provide) {
.config(['$provide', function($provide) {
var reflowQueue = [];

$provide.value('$$animateReflow', function(fn) {
reflowQueue.push(fn);
return angular.noop;
});
$provide.decorator('$animate', function($delegate) {
$delegate.triggerReflow = function() {
if(reflowQueue.length === 0) {
throw new Error('No animation reflows present');
}
angular.forEach(reflowQueue, function(fn) {
fn();
});
reflowQueue = [];
};
return $delegate;
});
}]);
}

angular.mock.animate = angular.module('mock.animate', ['ng'])

.config(['$provide', function($provide) {

$provide.decorator('$animate', function($delegate) {
var animate = {
queue : [],
enabled : $delegate.enabled,
flushNext : function(name) {
var tick = animate.queue.shift();

if (!tick) throw new Error('No animation to be flushed');
if(tick.method !== name) {
throw new Error('The next animation is not "' + name +
'", but is "' + tick.method + '"');
triggerReflow : function() {
if(reflowQueue.length === 0) {
throw new Error('No animation reflows present');
}
tick.fn();
return tick;
angular.forEach(reflowQueue, function(fn) {
fn();
});
reflowQueue = [];
}
};

angular.forEach(['enter','leave','move','addClass','removeClass'], function(method) {
angular.forEach(
['enter','leave','move','addClass','removeClass','setClass'], function(method) {
animate[method] = function() {
var params = arguments;
animate.queue.push({
method : method,
params : params,
element : angular.isElement(params[0]) && params[0],
parent : angular.isElement(params[1]) && params[1],
after : angular.isElement(params[2]) && params[2],
fn : function() {
$delegate[method].apply($delegate, params);
}
event : method,
element : arguments[0],
args : arguments
});
$delegate[method].apply($delegate, arguments);
};
});

Expand Down Expand Up @@ -996,18 +967,18 @@ angular.mock.dump = function(object) {
*
* # Flushing HTTP requests
*
* The $httpBackend used in production, always responds to requests with responses asynchronously.
* If we preserved this behavior in unit testing, we'd have to create async unit tests, which are
* hard to write, follow and maintain. At the same time the testing mock, can't respond
* The $httpBackend used in production always responds to requests with responses asynchronously.
* If we preserved this behavior in unit testing we'd have to create async unit tests, which are
* hard to write, understand, and maintain. However, the testing mock can't respond
* synchronously because that would change the execution of the code under test. For this reason the
* mock $httpBackend has a `flush()` method, which allows the test to explicitly flush pending
* requests and thus preserving the async api of the backend, while allowing the test to execute
* requests and thus preserve the async api of the backend while allowing the test to execute
* synchronously.
*
*
* # Unit testing with mock $httpBackend
* The following code shows how to setup and use the mock backend in unit testing a controller.
* First we create the controller under test
* The following code shows how to setup and use the mock backend when unit testing a controller.
* First we create the controller under test:
*
<pre>
// The controller code
Expand All @@ -1032,7 +1003,7 @@ angular.mock.dump = function(object) {
}
</pre>
*
* Now we setup the mock backend and create the test specs.
* Now we setup the mock backend and create the test specs:
*
<pre>
// testing controller
Expand Down Expand Up @@ -1954,7 +1925,7 @@ if(window.jasmine || window.mocha) {

var currentSpec = null,
isSpecRunning = function() {
return currentSpec && (window.mocha || currentSpec.queue.running);
return !!currentSpec;
};


Expand Down Expand Up @@ -2132,7 +2103,7 @@ if(window.jasmine || window.mocha) {
window.inject = angular.mock.inject = function() {
var blockFns = Array.prototype.slice.call(arguments, 0);
var errorForStack = new Error('Declaration Location');
return isSpecRunning() ? workFn() : workFn;
return isSpecRunning() ? workFn.call(currentSpec) : workFn;
/////////////////////
function workFn() {
var modules = currentSpec.$modules || [];
Expand Down
8 changes: 5 additions & 3 deletions config/lib/js/angular/angular-resource.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @license AngularJS v1.2.10
* @license AngularJS v1.2.13
* (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT
*/
Expand Down Expand Up @@ -40,7 +40,7 @@ function shallowClearAndCopy(src, dst) {
});

for (var key in src) {
if (src.hasOwnProperty(key) && key.charAt(0) !== '$' && key.charAt(1) !== '$') {
if (src.hasOwnProperty(key) && !(key.charAt(0) === '$' && key.charAt(1) === '$')) {
dst[key] = src[key];
}
}
Expand Down Expand Up @@ -392,7 +392,9 @@ angular.module('ngResource', ['ng']).
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
if (angular.isDefined(val) && val !== null) {
encodedVal = encodeUriSegment(val);
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), encodedVal + "$1");
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function(match, p1) {
return encodedVal + p1;
});
} else {
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function(match,
leadingSlashes, tail) {
Expand Down
8 changes: 4 additions & 4 deletions config/lib/js/angular/angular-resource.min.js
100644 → 100755

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 97f4f6e

Please sign in to comment.