aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Bagayoko2013-04-03 19:34:47 -0500
committerIgor Minar2013-04-03 18:42:17 -0700
commit308a59bf445759b32c20e9057a6dcc241042bdca (patch)
treeef10b4f80e289917800f3d5abfe4f29c35f0bc49
parent19f1801379104bc1f74fbb9d288f71034ba829c9 (diff)
downloadangular.js-308a59bf445759b32c20e9057a6dcc241042bdca.tar.bz2
fix(ngAnimator): correct polyfillSetup activation and memento generation
-rw-r--r--src/ng/animator.js2
-rw-r--r--test/ng/animatorSpec.js21
2 files changed, 22 insertions, 1 deletions
diff --git a/src/ng/animator.js b/src/ng/animator.js
index f3714db8..662ed683 100644
--- a/src/ng/animator.js
+++ b/src/ng/animator.js
@@ -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
diff --git a/test/ng/animatorSpec.js b/test/ng/animatorSpec.js
index 07bcb36c..a8c6c547 100644
--- a/test/ng/animatorSpec.js
+++ b/test/ng/animatorSpec.js
@@ -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) {