@@ -24,7 +24,7 @@ describe('tabs', function() {
24
24
}
25
25
}
26
26
27
-
27
+
28
28
describe ( 'basics' , function ( ) {
29
29
30
30
beforeEach ( inject ( function ( $compile , $rootScope ) {
@@ -33,14 +33,16 @@ describe('tabs', function() {
33
33
scope . second = '2' ;
34
34
scope . actives = { } ;
35
35
scope . selectFirst = jasmine . createSpy ( ) ;
36
- scope . selectSecond = jasmine . createSpy ( ) ;
36
+ scope . selectSecond = jasmine . createSpy ( ) ;
37
+ scope . deselectFirst = jasmine . createSpy ( ) ;
38
+ scope . deselectSecond = jasmine . createSpy ( ) ;
37
39
elm = $compile ( [
38
40
'<div>' ,
39
41
' <tabset class="hello" data-pizza="pepperoni">' ,
40
- ' <tab heading="First Tab {{first}}" active="actives.one" select="selectFirst()">' ,
42
+ ' <tab heading="First Tab {{first}}" active="actives.one" select="selectFirst()" deselect="deselectFirst()" >' ,
41
43
' first content is {{first}}' ,
42
44
' </tab>' ,
43
- ' <tab active="actives.two" select="selectSecond()">' ,
45
+ ' <tab active="actives.two" select="selectSecond()" deselect="deselectSecond()" >' ,
44
46
' <tab-heading><b>Second</b> Tab {{second}}</tab-heading>' ,
45
47
' second content is {{second}}' ,
46
48
' </tab>' ,
@@ -90,6 +92,14 @@ describe('tabs', function() {
90
92
expect ( scope . selectFirst ) . toHaveBeenCalled ( ) ;
91
93
} ) ;
92
94
95
+ it ( 'should call deselect callback on deselect' , function ( ) {
96
+ titles ( ) . eq ( 1 ) . find ( 'a' ) . click ( ) ;
97
+ titles ( ) . eq ( 0 ) . find ( 'a' ) . click ( ) ;
98
+ expect ( scope . deselectSecond ) . toHaveBeenCalled ( ) ;
99
+ titles ( ) . eq ( 1 ) . find ( 'a' ) . click ( ) ;
100
+ expect ( scope . deselectFirst ) . toHaveBeenCalled ( ) ;
101
+ } ) ;
102
+
93
103
} ) ;
94
104
95
105
describe ( 'ng-repeat' , function ( ) {
@@ -208,7 +218,7 @@ describe('tabs', function() {
208
218
expect ( heading ( ) . eq ( 2 ) . text ( ) ) . toBe ( '2' ) ;
209
219
expect ( heading ( ) . eq ( 3 ) . text ( ) ) . toBe ( '3' ) ;
210
220
} ) ;
211
-
221
+
212
222
} ) ;
213
223
214
224
//Tests that http://git.io/lG6I9Q is fixed
0 commit comments