This repository was archived by the owner on May 29, 2019. It is now read-only.
File tree 2 files changed +28
-2
lines changed
2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ angular.module('ui.bootstrap.buttons', [])
44
44
45
45
if ( attrs . uibUncheckable ) {
46
46
scope . $watch ( uncheckableExpr , function ( uncheckable ) {
47
- attrs . $set ( 'uncheckable' , uncheckable ? '' : null ) ;
47
+ attrs . $set ( 'uncheckable' , uncheckable ? '' : undefined ) ;
48
48
} ) ;
49
49
}
50
50
}
Original file line number Diff line number Diff line change @@ -328,12 +328,38 @@ describe('buttons', function() {
328
328
$scope . uncheckable = false ;
329
329
var btns = compileButtons ( '<button ng-model="model" uib-btn-radio="1">click1</button><button ng-model="model" uib-btn-radio="2" uib-uncheckable="uncheckable">click2</button>' , $scope ) ;
330
330
expect ( btns . eq ( 0 ) . attr ( 'uncheckable' ) ) . toBeUndefined ( ) ;
331
- expect ( btns . eq ( 0 ) . attr ( 'uncheckable' ) ) . toBeUndefined ( ) ;
331
+ expect ( btns . eq ( 1 ) . attr ( 'uncheckable' ) ) . toBeUndefined ( ) ;
332
+
333
+ expect ( $scope . model ) . toBeUndefined ( ) ;
334
+
335
+ btns . eq ( 0 ) . click ( ) ;
336
+ expect ( $scope . model ) . toEqual ( 1 ) ;
337
+
338
+ btns . eq ( 0 ) . click ( ) ;
339
+ expect ( $scope . model ) . toEqual ( 1 ) ;
340
+
341
+ btns . eq ( 1 ) . click ( ) ;
342
+ expect ( $scope . model ) . toEqual ( 2 ) ;
343
+
344
+ btns . eq ( 1 ) . click ( ) ;
345
+ expect ( $scope . model ) . toEqual ( 2 ) ;
332
346
333
347
$scope . uncheckable = true ;
334
348
$scope . $digest ( ) ;
335
349
expect ( btns . eq ( 0 ) . attr ( 'uncheckable' ) ) . toBeUndefined ( ) ;
336
350
expect ( btns . eq ( 1 ) . attr ( 'uncheckable' ) ) . toBeDefined ( ) ;
351
+
352
+ btns . eq ( 0 ) . click ( ) ;
353
+ expect ( $scope . model ) . toEqual ( 1 ) ;
354
+
355
+ btns . eq ( 0 ) . click ( ) ;
356
+ expect ( $scope . model ) . toEqual ( 1 ) ;
357
+
358
+ btns . eq ( 1 ) . click ( ) ;
359
+ expect ( $scope . model ) . toEqual ( 2 ) ;
360
+
361
+ btns . eq ( 1 ) . click ( ) ;
362
+ expect ( $scope . model ) . toBeNull ( ) ;
337
363
} ) ;
338
364
} ) ;
339
365
} ) ;
You can’t perform that action at this time.
0 commit comments