File tree 2 files changed +22
-4
lines changed
test/unit/angular/directive
2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -125,19 +125,21 @@ function headerFooterBarDirective(isHeader) {
125
125
126
126
if ( isHeader ) {
127
127
$scope . $watch ( function ( ) { return el . className ; } , function ( value ) {
128
+ var isShown = value . indexOf ( 'ng-hide' ) === - 1 ;
128
129
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 ;
131
132
} ) ;
132
133
$scope . $on ( '$destroy' , function ( ) {
133
134
delete $scope . $hasHeader ;
134
135
delete $scope . $hasSubheader ;
135
136
} ) ;
136
137
} else {
137
138
$scope . $watch ( function ( ) { return el . className ; } , function ( value ) {
139
+ var isShown = value . indexOf ( 'ng-hide' ) === - 1 ;
138
140
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 ;
141
143
} ) ;
142
144
$scope . $on ( '$destroy' , function ( ) {
143
145
delete $scope . $hasFooter ;
Original file line number Diff line number Diff line change @@ -109,6 +109,14 @@ describe('bar directives', function() {
109
109
scope . $apply ( ) ;
110
110
expect ( scope . $hasHeader ) . toEqual ( true ) ;
111
111
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 ) ;
112
120
} ) ;
113
121
} else {
114
122
it ( '$hasFooter $hasSubheader' , function ( ) {
@@ -124,6 +132,14 @@ describe('bar directives', function() {
124
132
scope . $apply ( ) ;
125
133
expect ( scope . $hasFooter ) . toEqual ( true ) ;
126
134
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 ) ;
127
143
} ) ;
128
144
it ( '.has-tabs' , function ( ) {
129
145
var el = setup ( ) ;
You can’t perform that action at this time.
0 commit comments