mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
fix(ngAnimator): correct polyfillSetup activation and memento generation
This commit is contained in:
parent
19f1801379
commit
308a59bf44
2 changed files with 22 additions and 1 deletions
|
|
@ -240,7 +240,7 @@ var $AnimatorProvider = function() {
|
|||
beforeFn(element, parent, after);
|
||||
if (element.length == 0) return done();
|
||||
|
||||
var memento = (noop || polyfillSetup)(element);
|
||||
var memento = (polyfillSetup || noop)(element);
|
||||
|
||||
// $window.setTimeout(beginAnimation, 0); this was causing the element not to animate
|
||||
// keep at 1 for animation dom rerender
|
||||
|
|
|
|||
|
|
@ -76,6 +76,17 @@ describe("$animator", function() {
|
|||
}
|
||||
}
|
||||
});
|
||||
$animationProvider.register('setup-memo', function() {
|
||||
return {
|
||||
setup: function(element) {
|
||||
return "memento";
|
||||
},
|
||||
start: function(element, done, memento) {
|
||||
element.text(memento);
|
||||
done();
|
||||
}
|
||||
}
|
||||
});
|
||||
})
|
||||
inject(function($animator, $compile, $rootScope) {
|
||||
element = $compile('<div></div>')($rootScope);
|
||||
|
|
@ -185,6 +196,16 @@ describe("$animator", function() {
|
|||
expect(child.attr('class')).toContain('custom-leave-start');
|
||||
window.setTimeout.expect(0).process();
|
||||
}));
|
||||
|
||||
it("should run polyfillSetup and return the memento", inject(function($animator, $rootScope) {
|
||||
animator = $animator($rootScope, {
|
||||
ngAnimate : '{show: \'setup-memo\'}'
|
||||
});
|
||||
expect(element.text()).toEqual('');
|
||||
animator.show(element);
|
||||
window.setTimeout.expect(1).process();
|
||||
expect(element.text()).toBe('memento');
|
||||
}));
|
||||
});
|
||||
|
||||
it("should throw an error when an invalid ng-animate syntax is provided", inject(function($compile, $rootScope) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue