Skip to content

Commit 308a59b

Browse files
wbyokoIgorMinar
authored andcommitted
fix(ngAnimator): correct polyfillSetup activation and memento generation
1 parent 19f1801 commit 308a59b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/ng/animator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ var $AnimatorProvider = function() {
240240
beforeFn(element, parent, after);
241241
if (element.length == 0) return done();
242242

243-
var memento = (noop || polyfillSetup)(element);
243+
var memento = (polyfillSetup || noop)(element);
244244

245245
// $window.setTimeout(beginAnimation, 0); this was causing the element not to animate
246246
// keep at 1 for animation dom rerender

test/ng/animatorSpec.js

+21
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ describe("$animator", function() {
7676
}
7777
}
7878
});
79+
$animationProvider.register('setup-memo', function() {
80+
return {
81+
setup: function(element) {
82+
return "memento";
83+
},
84+
start: function(element, done, memento) {
85+
element.text(memento);
86+
done();
87+
}
88+
}
89+
});
7990
})
8091
inject(function($animator, $compile, $rootScope) {
8192
element = $compile('<div></div>')($rootScope);
@@ -185,6 +196,16 @@ describe("$animator", function() {
185196
expect(child.attr('class')).toContain('custom-leave-start');
186197
window.setTimeout.expect(0).process();
187198
}));
199+
200+
it("should run polyfillSetup and return the memento", inject(function($animator, $rootScope) {
201+
animator = $animator($rootScope, {
202+
ngAnimate : '{show: \'setup-memo\'}'
203+
});
204+
expect(element.text()).toEqual('');
205+
animator.show(element);
206+
window.setTimeout.expect(1).process();
207+
expect(element.text()).toBe('memento');
208+
}));
188209
});
189210

190211
it("should throw an error when an invalid ng-animate syntax is provided", inject(function($compile, $rootScope) {

0 commit comments

Comments
 (0)