Skip to content
This repository has been archived by the owner on Aug 29, 2023. It is now read-only.

Commit

Permalink
fix(mdRadioButton): Loosen equality check
Browse files Browse the repository at this point in the history
Closes #1112
  • Loading branch information
Marcy Sutton authored and ThomasBurleson committed Jan 8, 2015
1 parent 7bd6859 commit ca3e4c3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/radioButton/demoBasicUsage/script.js
Expand Up @@ -9,8 +9,8 @@ angular.module('radioDemo1', ['ngMaterial'])
};

$scope.radioData = [
{ label: '1', value: '1' },
{ label: '2', value: '2' },
{ label: '1', value: 1 },
{ label: '2', value: 2 },
{ label: '3', value: '3', isDisabled: true },
{ label: '4', value: '4' }
];
Expand Down
2 changes: 1 addition & 1 deletion src/components/radioButton/radioButton.js
Expand Up @@ -246,7 +246,7 @@ function mdRadioButtonDirective($mdAria, $mdUtil, $mdTheming) {
}

function render() {
var checked = (rgCtrl.getViewValue() === attr.value);
var checked = (rgCtrl.getViewValue() == attr.value);
if (checked === lastChecked) {
return;
}
Expand Down
14 changes: 14 additions & 0 deletions src/components/radioButton/radioButton.spec.js
Expand Up @@ -20,6 +20,20 @@ describe('radioButton', function() {
expect(rbElements.eq(1).hasClass(CHECKED_CSS)).toEqual(true);
}));

it('should support mixed values', inject(function($compile, $rootScope) {
var element = $compile('<md-radio-group ng-model="value">' +
'<md-radio-button value="1"></md-radio-button>' +
'<md-radio-button value="2"></md-radio-button>' +
'</md-radio-group>')($rootScope);

$rootScope.$apply(function(){
$rootScope.value = 1;
});

var rbElements = element.find('md-radio-button');
expect(rbElements.eq(0).hasClass(CHECKED_CSS)).toEqual(true);
}));

it('should set roles', inject(function($compile, $rootScope) {

var element = $compile('<md-radio-group ng-model="color">' +
Expand Down

0 comments on commit ca3e4c3

Please sign in to comment.