This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree 2 files changed +21
-1
lines changed
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ angular.module('ui.bootstrap.dropdown', [])
93
93
}
94
94
95
95
setIsOpen ( $scope , isOpen ) ;
96
- if ( angular . isDefined ( wasOpen ) && isOpen !== wasOpen ) {
96
+ if ( angular . isDefined ( isOpen ) && isOpen !== wasOpen ) {
97
97
toggleInvoker ( $scope , { open : ! ! isOpen } ) ;
98
98
}
99
99
} ) ;
Original file line number Diff line number Diff line change @@ -253,4 +253,24 @@ describe('dropdownToggle', function() {
253
253
expect ( $rootScope . toggleHandler ) . toHaveBeenCalledWith ( true ) ;
254
254
} ) ;
255
255
} ) ;
256
+
257
+ describe ( '`on-toggle` without is-open' , function ( ) {
258
+ beforeEach ( function ( ) {
259
+ $rootScope . toggleHandler = jasmine . createSpy ( 'toggleHandler' ) ;
260
+ element = $compile ( '<li class="dropdown" on-toggle="toggleHandler(open)"><a dropdown-toggle></a><ul><li>Hello</li></ul></li>' ) ( $rootScope ) ;
261
+ $rootScope . $digest ( ) ;
262
+ } ) ;
263
+
264
+ it ( 'should not have been called initially' , function ( ) {
265
+ expect ( $rootScope . toggleHandler ) . not . toHaveBeenCalled ( ) ;
266
+ } ) ;
267
+
268
+ it ( 'should call it when clicked' , function ( ) {
269
+ clickDropdownToggle ( ) ;
270
+ expect ( $rootScope . toggleHandler ) . toHaveBeenCalledWith ( true ) ;
271
+
272
+ clickDropdownToggle ( ) ;
273
+ expect ( $rootScope . toggleHandler ) . toHaveBeenCalledWith ( false ) ;
274
+ } ) ;
275
+ } ) ;
256
276
} ) ;
You can’t perform that action at this time.
0 commit comments