Skip to content

Commit 72a1b48

Browse files
chore(test): update to ng 1.3.20
1 parent 52ec0a8 commit 72a1b48

File tree

3 files changed

+127
-78
lines changed

3 files changed

+127
-78
lines changed

test/angular/1.3/angular-animate.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license AngularJS v1.3.17
2+
* @license AngularJS v1.3.20
33
* (c) 2010-2014 Google, Inc. http://angularjs.org
44
* License: MIT
55
*/
@@ -1200,18 +1200,21 @@ angular.module('ngAnimate', ['ng'])
12001200
}
12011201

12021202
return cache.promise = runAnimationPostDigest(function(done) {
1203-
var parentElement = element.parent();
1204-
var elementNode = extractElementNode(element);
1205-
var parentNode = elementNode.parentNode;
1203+
var cache, parentNode, parentElement, elementNode = extractElementNode(element);
1204+
if (elementNode) {
1205+
cache = element.data(STORAGE_KEY);
1206+
element.removeData(STORAGE_KEY);
1207+
1208+
parentElement = element.parent();
1209+
parentNode = elementNode.parentNode;
1210+
}
1211+
12061212
// TODO(matsko): move this code into the animationsDisabled() function once #8092 is fixed
12071213
if (!parentNode || parentNode['$$NG_REMOVED'] || elementNode['$$NG_REMOVED']) {
12081214
done();
12091215
return;
12101216
}
12111217

1212-
var cache = element.data(STORAGE_KEY);
1213-
element.removeData(STORAGE_KEY);
1214-
12151218
var state = element.data(NG_ANIMATE_STATE) || {};
12161219
var classes = resolveElementClasses(element, cache, state.active);
12171220
return !classes

test/angular/1.3/angular-mocks.js

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @license AngularJS v1.3.17
2+
* @license AngularJS v1.3.20
33
* (c) 2010-2014 Google, Inc. http://angularjs.org
44
* License: MIT
55
*/
@@ -789,8 +789,8 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
789789
};
790790
});
791791

792-
$provide.decorator('$animate', ['$delegate', '$$asyncCallback', '$timeout', '$browser',
793-
function($delegate, $$asyncCallback, $timeout, $browser) {
792+
$provide.decorator('$animate', ['$delegate', '$$asyncCallback', '$timeout', '$browser', '$rootScope', '$$rAF',
793+
function($delegate, $$asyncCallback, $timeout, $browser, $rootScope, $$rAF) {
794794
var animate = {
795795
queue: [],
796796
cancel: $delegate.cancel,
@@ -810,6 +810,43 @@ angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
810810
fn();
811811
});
812812
reflowQueue = [];
813+
},
814+
flush: function() {
815+
$rootScope.$digest();
816+
var doNextRun, somethingFlushed = false;
817+
do {
818+
doNextRun = false;
819+
if (reflowQueue.length) {
820+
doNextRun = somethingFlushed = true;
821+
this.triggerReflow();
822+
}
823+
if ($$rAF.queue.length) {
824+
doNextRun = somethingFlushed = true;
825+
$$rAF.flush();
826+
}
827+
if ($$asyncCallback.queue.length) {
828+
doNextRun = somethingFlushed = true;
829+
this.triggerCallbackEvents();
830+
}
831+
if (timeoutsRemaining()) {
832+
var oldValue = timeoutsRemaining();
833+
this.triggerCallbackPromise();
834+
var newValue = timeoutsRemaining();
835+
if (newValue < oldValue) {
836+
doNextRun = somethingFlushed = true;
837+
}
838+
}
839+
} while (doNextRun);
840+
841+
if (!somethingFlushed) {
842+
throw new Error('No pending animations ready to be closed or flushed');
843+
}
844+
845+
$rootScope.$digest();
846+
847+
function timeoutsRemaining() {
848+
return $browser.deferredFns.length;
849+
}
813850
}
814851
};
815852

@@ -1759,15 +1796,16 @@ angular.mock.$TimeoutDecorator = ['$delegate', '$browser', function($delegate, $
17591796
}];
17601797

17611798
angular.mock.$RAFDecorator = ['$delegate', function($delegate) {
1762-
var queue = [];
1763-
var rafFn = function(fn) {
1799+
var queue, rafFn = function(fn) {
17641800
var index = queue.length;
17651801
queue.push(fn);
17661802
return function() {
17671803
queue.splice(index, 1);
17681804
};
17691805
};
17701806

1807+
queue = rafFn.queue = [];
1808+
17711809
rafFn.supported = $delegate.supported;
17721810

17731811
rafFn.flush = function() {
@@ -1780,22 +1818,22 @@ angular.mock.$RAFDecorator = ['$delegate', function($delegate) {
17801818
queue[i]();
17811819
}
17821820

1783-
queue = [];
1821+
queue.length = 0;
17841822
};
17851823

17861824
return rafFn;
17871825
}];
17881826

17891827
angular.mock.$AsyncCallbackDecorator = ['$delegate', function($delegate) {
1790-
var callbacks = [];
1791-
var addFn = function(fn) {
1792-
callbacks.push(fn);
1828+
var queue, addFn = function(fn) {
1829+
queue.push(fn);
17931830
};
1831+
queue = addFn.queue = [];
17941832
addFn.flush = function() {
1795-
angular.forEach(callbacks, function(fn) {
1833+
angular.forEach(queue, function(fn) {
17961834
fn();
17971835
});
1798-
callbacks = [];
1836+
queue.length = 0;
17991837
};
18001838
return addFn;
18011839
}];

0 commit comments

Comments
 (0)