diff --git a/src/buttons/buttons.js b/src/buttons/buttons.js
index 1548bead3b..4d28026e9a 100644
--- a/src/buttons/buttons.js
+++ b/src/buttons/buttons.js
@@ -44,7 +44,7 @@ angular.module('ui.bootstrap.buttons', [])
if (attrs.uibUncheckable) {
scope.$watch(uncheckableExpr, function(uncheckable) {
- attrs.$set('uncheckable', uncheckable ? '' : null);
+ attrs.$set('uncheckable', uncheckable ? '' : undefined);
});
}
}
diff --git a/src/buttons/test/buttons.spec.js b/src/buttons/test/buttons.spec.js
index 6116119a8f..de2945f45a 100644
--- a/src/buttons/test/buttons.spec.js
+++ b/src/buttons/test/buttons.spec.js
@@ -328,12 +328,38 @@ describe('buttons', function() {
$scope.uncheckable = false;
var btns = compileButtons('', $scope);
expect(btns.eq(0).attr('uncheckable')).toBeUndefined();
- expect(btns.eq(0).attr('uncheckable')).toBeUndefined();
+ expect(btns.eq(1).attr('uncheckable')).toBeUndefined();
+
+ expect($scope.model).toBeUndefined();
+
+ btns.eq(0).click();
+ expect($scope.model).toEqual(1);
+
+ btns.eq(0).click();
+ expect($scope.model).toEqual(1);
+
+ btns.eq(1).click();
+ expect($scope.model).toEqual(2);
+
+ btns.eq(1).click();
+ expect($scope.model).toEqual(2);
$scope.uncheckable = true;
$scope.$digest();
expect(btns.eq(0).attr('uncheckable')).toBeUndefined();
expect(btns.eq(1).attr('uncheckable')).toBeDefined();
+
+ btns.eq(0).click();
+ expect($scope.model).toEqual(1);
+
+ btns.eq(0).click();
+ expect($scope.model).toEqual(1);
+
+ btns.eq(1).click();
+ expect($scope.model).toEqual(2);
+
+ btns.eq(1).click();
+ expect($scope.model).toBeNull();
});
});
});