diff --git a/src/buttons/buttons.js b/src/buttons/buttons.js index 4d28026e9a..515f9530f0 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 ? '' : undefined); + attrs.$set('disabled', uncheckable ? 'disabled' : undefined); }); } } diff --git a/src/buttons/docs/demo.html b/src/buttons/docs/demo.html index 1ceeabbc60..a96671a1b6 100644 --- a/src/buttons/docs/demo.html +++ b/src/buttons/docs/demo.html @@ -20,13 +20,16 @@

Radio & Uncheckable Radio

- - + +
+
+   + uncheckable: {{uncheckable}}
diff --git a/src/buttons/test/buttons.spec.js b/src/buttons/test/buttons.spec.js index de2945f45a..f25e7f427e 100644 --- a/src/buttons/test/buttons.spec.js +++ b/src/buttons/test/buttons.spec.js @@ -324,11 +324,11 @@ describe('buttons', function() { }); describe('uibUncheckable', function() { - it('should set uncheckable', function() { + it('should set disabled', function() { $scope.uncheckable = false; var btns = compileButtons('', $scope); - expect(btns.eq(0).attr('uncheckable')).toBeUndefined(); - expect(btns.eq(1).attr('uncheckable')).toBeUndefined(); + expect(btns.eq(0).attr('disabled')).toBeUndefined(); + expect(btns.eq(1).attr('disabled')).toBeUndefined(); expect($scope.model).toBeUndefined(); @@ -346,8 +346,8 @@ describe('buttons', function() { $scope.uncheckable = true; $scope.$digest(); - expect(btns.eq(0).attr('uncheckable')).toBeUndefined(); - expect(btns.eq(1).attr('uncheckable')).toBeDefined(); + expect(btns.eq(0).attr('disabled')).toBeUndefined(); + expect(btns.eq(1).attr('disabled')).toBeDefined(); btns.eq(0).click(); expect($scope.model).toEqual(1); @@ -356,10 +356,10 @@ describe('buttons', function() { expect($scope.model).toEqual(1); btns.eq(1).click(); - expect($scope.model).toEqual(2); + expect($scope.model).toEqual(1); btns.eq(1).click(); - expect($scope.model).toBeNull(); + expect($scope.model).toEqual(1); }); }); });