Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 90098ef

Browse files
committed
wip
1 parent d5f993c commit 90098ef

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

src/ngAnimate/animateCss.js

+17-17
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
196196
return stagger;
197197
}
198198

199-
var cancelLastRefRequest, bod = $document[0].body;
199+
var cancelLastRAFRequest, bod = $document[0].body;
200200
function waitUntilQuiet(callback) {
201-
if (cancelLastRafRequest) {
202-
cancelLastRafRequest(); //cancels the request
201+
if (cancelLastRAFRequest) {
202+
cancelLastRAFRequest(); //cancels the request
203203
}
204-
cancelLastRafRequest = $$rAF(function() {
205-
cancelLastRequest = null;
204+
cancelLastRAFRequest = $$rAF(function() {
205+
cancelLastRAFRequest = null;
206206
gcsLookup.flush();
207207
gcsStaggerLookup.flush();
208208

@@ -247,6 +247,7 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
247247
var animationPaused;
248248
var animationCompleted;
249249
var runner;
250+
var runnerHost;
250251

251252
if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {
252253
close();
@@ -443,13 +444,15 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
443444
start: function() {
444445
if (animationClosed) return;
445446

446-
runner = new $animateRunner({
447+
runnerHost = {
447448
end: endFn,
448449
cancel: cancelFn
449-
});
450+
};
451+
452+
runner = new $animateRunner(runnerHost);
450453

451454
waitUntilQuiet(function() {
452-
start(deferred);
455+
start();
453456
});
454457

455458
// we don't have access to pause/resume the animation
@@ -554,16 +557,13 @@ var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
554557
}
555558

556559
// this will decorate the existing promise runner with pause/resume methods
557-
$$animateRunner(deferred.promise, {
558-
resume: function() {
559-
playPause(true);
560-
},
561-
pause: function() {
562-
playPause(false);
563-
}
564-
});
560+
runnerHost.resume = function() {
561+
playPause(true);
562+
};
565563

566-
return deferred.promise;
564+
runnerHost.pause = function() {
565+
playPause(false);
566+
};
567567

568568
function triggerAnimationStart() {
569569
// just incase a stagger animation kicks in when the animation

test/ngAnimate/animateCssSpec.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
describe("ngAnimate $animateCss", function() {
3+
ddescribe("ngAnimate $animateCss", function() {
44

55
beforeEach(module('ngAnimate'));
66

@@ -50,7 +50,7 @@ describe("ngAnimate $animateCss", function() {
5050

5151
describe("rAF usage", function() {
5252
it("should buffer all requests into a single requestAnimationFrame call",
53-
inject(function($animateCss, $$rAF, $document, $rootElement) {
53+
inject(function($animateCss, $$rAF, $rootScope, $document, $rootElement) {
5454

5555
angular.element($document[0].body).append($rootElement);
5656

@@ -76,6 +76,8 @@ describe("ngAnimate $animateCss", function() {
7676
forEach(runners, function(runner) {
7777
runner.end();
7878
});
79+
80+
$rootScope.$digest();
7981
expect(count).toBe(3);
8082
}));
8183

@@ -188,7 +190,9 @@ describe("ngAnimate $animateCss", function() {
188190
expect(element).not.toHaveClass('ng-enter-active');
189191
}));
190192

191-
it('should return a runner object at the start of the animation that is an extension of a promise', inject(function() {
193+
iit('should return a runner object at the start of the animation that contains a `then` method',
194+
inject(function($rootScope) {
195+
192196
var runner = animator.start();
193197
triggerAnimationStartFrame();
194198

@@ -200,6 +204,7 @@ describe("ngAnimate $animateCss", function() {
200204
});
201205

202206
runner.end();
207+
$rootScope.$digest();
203208
expect(resolved).toBeTruthy();
204209
}));
205210

0 commit comments

Comments
 (0)