@@ -600,6 +600,46 @@ describe('ngView animations', function() {
600
600
expect ( itemA ) . not . toEqual ( itemB ) ;
601
601
var itemB = $animate . flushNext ( 'enter' ) . element ;
602
602
} ) ) ;
603
+
604
+ it ( 'should render ngClass on ngView' ,
605
+ inject ( function ( $compile , $rootScope , $templateCache , $animate , $location , $timeout ) {
606
+
607
+ var item ;
608
+ $rootScope . tpl = 'one' ;
609
+ $rootScope . klass = 'classy' ;
610
+ element = $compile ( html ( '<div><div ng-view ng-class="klass"></div></div>' ) ) ( $rootScope ) ;
611
+ $rootScope . $digest ( ) ;
612
+
613
+ $location . path ( '/foo' ) ;
614
+ $rootScope . $digest ( ) ;
615
+
616
+ item = $animate . flushNext ( 'enter' ) . element ;
617
+
618
+ $animate . flushNext ( 'addClass' ) . element ;
619
+ $animate . flushNext ( 'addClass' ) . element ;
620
+
621
+ expect ( item . hasClass ( 'classy' ) ) . toBe ( true ) ;
622
+
623
+ $rootScope . klass = 'boring' ;
624
+ $rootScope . $digest ( ) ;
625
+
626
+ $animate . flushNext ( 'removeClass' ) . element ;
627
+ $animate . flushNext ( 'addClass' ) . element ;
628
+
629
+ expect ( item . hasClass ( 'classy' ) ) . toBe ( false ) ;
630
+ expect ( item . hasClass ( 'boring' ) ) . toBe ( true ) ;
631
+
632
+ $location . path ( '/bar' ) ;
633
+ $rootScope . $digest ( ) ;
634
+
635
+ $animate . flushNext ( 'leave' ) . element ;
636
+ item = $animate . flushNext ( 'enter' ) . element ;
637
+
638
+ $animate . flushNext ( 'addClass' ) . element ;
639
+ $animate . flushNext ( 'addClass' ) . element ;
640
+
641
+ expect ( item . hasClass ( 'boring' ) ) . toBe ( true ) ;
642
+ } ) ) ;
603
643
} ) ;
604
644
605
645
it ( 'should not double compile when the route changes' , function ( ) {
0 commit comments