diff options
| author | Matias Niemelàˆ | 2013-04-09 18:33:16 -0400 |
|---|---|---|
| committer | Misko Hevery | 2013-04-11 14:15:20 -0700 |
| commit | 1351ba2632b5011ad6eaddf004a7f0411bea8453 (patch) | |
| tree | 2afaf00419536007ee6330a3ff047708e931d5b5 /test/ng/directive/ngRepeatSpec.js | |
| parent | 5476cb6e9b6d7a16e3a86585bc2db5e63b16cd4d (diff) | |
| download | angular.js-1351ba2632b5011ad6eaddf004a7f0411bea8453.tar.bz2 | |
fix(ngAnimate): skip animation on first render
Diffstat (limited to 'test/ng/directive/ngRepeatSpec.js')
| -rw-r--r-- | test/ng/directive/ngRepeatSpec.js | 43 |
1 files changed, 30 insertions, 13 deletions
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index 533b83c8..070e6e02 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -513,7 +513,24 @@ describe('ngRepeat', function() { }); describe('ngRepeat ngAnimate', function() { - var element, vendorPrefix, window; + var vendorPrefix, window; + var body, element; + + function html(html) { + body.html(html); + element = body.children().eq(0); + return element; + } + + beforeEach(function() { + // we need to run animation on attached elements; + body = jqLite(document.body); + }); + + afterEach(function(){ + dealoc(body); + dealoc(element); + }); beforeEach(module(function($animationProvider, $provide) { $provide.value('$window', window = angular.mock.createMockWindow()); @@ -522,20 +539,18 @@ describe('ngRepeat ngAnimate', function() { }; })); - afterEach(function(){ - dealoc(element); - }); - it('should fire off the enter animation + add and remove the css classes', inject(function($compile, $rootScope, $sniffer) { - element = $compile( + element = $compile(html( '<div><div ' + 'ng-repeat="item in items" ' + 'ng-animate="{enter: \'custom-enter\'}">' + '{{ item }}' + '</div></div>' - )($rootScope); + ))($rootScope); + + $rootScope.$digest(); // re-enable the animations; $rootScope.items = ['1','2','3']; $rootScope.$digest(); @@ -572,13 +587,13 @@ describe('ngRepeat ngAnimate', function() { it('should fire off the leave animation + add and remove the css classes', inject(function($compile, $rootScope, $sniffer) { - element = $compile( + element = $compile(html( '<div><div ' + 'ng-repeat="item in items" ' + 'ng-animate="{leave: \'custom-leave\'}">' + '{{ item }}' + '</div></div>' - )($rootScope); + ))($rootScope); $rootScope.items = ['1','2','3']; $rootScope.$digest(); @@ -612,13 +627,13 @@ describe('ngRepeat ngAnimate', function() { it('should fire off the move animation + add and remove the css classes', inject(function($compile, $rootScope, $sniffer) { - element = $compile( + element = $compile(html( '<div>' + '<div ng-repeat="item in items" ng-animate="{move: \'custom-move\'}">' + '{{ item }}' + '</div>' + '</div>' - )($rootScope); + ))($rootScope); $rootScope.items = ['1','2','3']; $rootScope.$digest(); @@ -666,13 +681,15 @@ describe('ngRepeat ngAnimate', function() { it('should catch and use the correct duration for animation', inject(function($compile, $rootScope, $sniffer) { - element = $compile( + element = $compile(html( '<div><div ' + 'ng-repeat="item in items" ' + 'ng-animate="{enter: \'custom-enter\'}">' + '{{ item }}' + '</div></div>' - )($rootScope); + ))($rootScope); + + $rootScope.$digest(); // re-enable the animations; $rootScope.items = ['a','b']; $rootScope.$digest(); |
