Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit 5d830fe

Browse files
committed
fix(buttons): doble toggle on spacebar
1 parent 02425b8 commit 5d830fe

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

Diff for: src/buttons/buttons.js

-12
Original file line numberDiff line numberDiff line change
@@ -82,18 +82,6 @@ angular.module('ui.bootstrap.buttons', [])
8282
ngModelCtrl.$render();
8383
});
8484
});
85-
86-
//accessibility
87-
element.on('keypress', function(e) {
88-
if (attrs.disabled || e.which !== 32 || $document[0].activeElement !== element[0]) {
89-
return;
90-
}
91-
92-
scope.$apply(function() {
93-
ngModelCtrl.$setViewValue(element.hasClass(buttonsCtrl.activeClass) ? getFalseValue() : getTrueValue());
94-
ngModelCtrl.$render();
95-
});
96-
});
9785
}
9886
};
9987
}]);

Diff for: src/buttons/test/buttons.spec.js

-21
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,6 @@ describe('buttons', function() {
7474
expect(btn).not.toHaveClass('active');
7575
});
7676

77-
it('should toggle custom model values on spacebar if focused', function() {
78-
$scope.model = 0;
79-
var btn = compileButton('<button ng-model="model" uib-btn-checkbox btn-checkbox-true="1" btn-checkbox-false="0">click</button>', $scope);
80-
$('body').append(btn);
81-
var e = $.Event('keypress');
82-
e.which = 32;
83-
84-
btn[0].focus();
85-
btn.trigger(e);
86-
$scope.$digest();
87-
expect($scope.model).toEqual(1);
88-
expect(btn).toHaveClass('active');
89-
90-
btn.trigger(e);
91-
$scope.$digest();
92-
expect($scope.model).toEqual(0);
93-
expect(btn).not.toHaveClass('active');
94-
95-
btn.remove();
96-
});
97-
9877
it('should monitor true / false value changes - issue 666', function() {
9978

10079
$scope.model = 1;

0 commit comments

Comments
 (0)