@@ -1817,6 +1817,42 @@ describe("ngAnimate", function() {
1817
1817
// expect(element.hasClass('hiding')).toBe(false);
1818
1818
// });
1819
1819
// });
1820
+ it ( "should remove all the previous classes when the next animation is applied before a reflow" , function ( ) {
1821
+ var fn , interceptedClass ;
1822
+ module ( function ( $animateProvider ) {
1823
+ $animateProvider . register ( '.three' , function ( ) {
1824
+ return {
1825
+ move : function ( element , done ) {
1826
+ fn = function ( ) {
1827
+ done ( ) ;
1828
+ }
1829
+ return function ( ) {
1830
+ interceptedClass = element . attr ( 'class' ) ;
1831
+ }
1832
+ }
1833
+ }
1834
+ } ) ;
1835
+ } ) ;
1836
+ inject ( function ( $compile , $rootScope , $animate , $timeout ) {
1837
+ var parent = html ( $compile ( '<div class="parent"></div>' ) ( $rootScope ) ) ;
1838
+ var one = $compile ( '<div class="one"></div>' ) ( $rootScope ) ;
1839
+ var two = $compile ( '<div class="two"></div>' ) ( $rootScope ) ;
1840
+ var three = $compile ( '<div class="three klass"></div>' ) ( $rootScope ) ;
1841
+
1842
+ parent . append ( one ) ;
1843
+ parent . append ( two ) ;
1844
+ parent . append ( three ) ;
1845
+
1846
+ $animate . move ( three , null , two ) ;
1847
+ $rootScope . $digest ( ) ;
1848
+
1849
+ $animate . move ( three , null , one ) ;
1850
+ $rootScope . $digest ( ) ;
1851
+
1852
+ //this means that the former animation was cleaned up before the new one starts
1853
+ expect ( interceptedClass . indexOf ( 'ng-animate' ) >= 0 ) . toBe ( false ) ;
1854
+ } ) ;
1855
+ } ) ;
1820
1856
1821
1857
it ( "should provide the correct CSS class to the addClass and removeClass callbacks within a JS animation" , function ( ) {
1822
1858
module ( function ( $animateProvider ) {
0 commit comments