File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
test/unit/angular/directive Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -125,19 +125,21 @@ function headerFooterBarDirective(isHeader) {
125125
126126 if ( isHeader ) {
127127 $scope . $watch ( function ( ) { return el . className ; } , function ( value ) {
128+ var isShown = value . indexOf ( 'ng-hide' ) === - 1 ;
128129 var isSubheader = value . indexOf ( 'bar-subheader' ) !== - 1 ;
129- $scope . $hasHeader = ! isSubheader ;
130- $scope . $hasSubheader = isSubheader ;
130+ $scope . $hasHeader = isShown && ! isSubheader ;
131+ $scope . $hasSubheader = isShown && isSubheader ;
131132 } ) ;
132133 $scope . $on ( '$destroy' , function ( ) {
133134 delete $scope . $hasHeader ;
134135 delete $scope . $hasSubheader ;
135136 } ) ;
136137 } else {
137138 $scope . $watch ( function ( ) { return el . className ; } , function ( value ) {
139+ var isShown = value . indexOf ( 'ng-hide' ) === - 1 ;
138140 var isSubfooter = value . indexOf ( 'bar-subfooter' ) !== - 1 ;
139- $scope . $hasFooter = ! isSubfooter ;
140- $scope . $hasSubfooter = isSubfooter ;
141+ $scope . $hasFooter = isShown && ! isSubfooter ;
142+ $scope . $hasSubfooter = isShown && isSubfooter ;
141143 } ) ;
142144 $scope . $on ( '$destroy' , function ( ) {
143145 delete $scope . $hasFooter ;
Original file line number Diff line number Diff line change @@ -109,6 +109,14 @@ describe('bar directives', function() {
109109 scope . $apply ( ) ;
110110 expect ( scope . $hasHeader ) . toEqual ( true ) ;
111111 expect ( scope . $hasSubheader ) . toEqual ( false ) ;
112+ el . addClass ( 'ng-hide' ) ;
113+ scope . $apply ( ) ;
114+ expect ( scope . $hasHeader ) . toEqual ( false ) ;
115+ expect ( scope . $hasSubheader ) . toEqual ( false ) ;
116+ el . removeClass ( 'ng-hide' ) ;
117+ scope . $apply ( ) ;
118+ expect ( scope . $hasHeader ) . toEqual ( true ) ;
119+ expect ( scope . $hasSubheader ) . toEqual ( false ) ;
112120 } ) ;
113121 } else {
114122 it ( '$hasFooter $hasSubheader' , function ( ) {
@@ -124,6 +132,14 @@ describe('bar directives', function() {
124132 scope . $apply ( ) ;
125133 expect ( scope . $hasFooter ) . toEqual ( true ) ;
126134 expect ( scope . $hasSubfooter ) . toEqual ( false ) ;
135+ el . addClass ( 'ng-hide' ) ;
136+ scope . $apply ( ) ;
137+ expect ( scope . $hasFooter ) . toEqual ( false ) ;
138+ expect ( scope . $hasSubfooter ) . toEqual ( false ) ;
139+ el . removeClass ( 'ng-hide' ) ;
140+ scope . $apply ( ) ;
141+ expect ( scope . $hasFooter ) . toEqual ( true ) ;
142+ expect ( scope . $hasSubfooter ) . toEqual ( false ) ;
127143 } ) ;
128144 it ( '.has-tabs' , function ( ) {
129145 var el = setup ( ) ;
You can’t perform that action at this time.
0 commit comments