-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(radio): suport ng-disabled. Closes #1684
- Loading branch information
1 parent
3e6ce18
commit 704fe40
Showing
3 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html ng-app="ionicApp"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> | ||
|
||
<title>Radio Buttons</title> | ||
|
||
<link rel="stylesheet" href="../../dist/css/ionic.css"> | ||
<script src="../../../../dist/js/ionic.bundle.js"></script> | ||
</head> | ||
|
||
<body ng-controller="MainCtrl"> | ||
|
||
<ion-header-bar class="bar-positive"> | ||
<h1 class="title">Radio Buttons</h1> | ||
</ion-header-bar> | ||
|
||
<ion-content> | ||
{{ $parent.formData }} | ||
<div class="list"> | ||
|
||
<ion-radio ng-model="$parent.formData.applyDisabled" ng-value="true" name="applyDisabled">Apply Disabled</ion-radio> | ||
<ion-radio ng-model="$parent.formData.applyDisabled" ng-value="false" name="applyDisabled">Enable</ion-radio> | ||
|
||
<ion-radio ng-model="$parent.formData.color" ng-value="'red'" name="color" ng-disabled="$parent.formData.applyDisabled">gets disabled Red</ion-radio> | ||
<ion-radio ng-model="$parent.formData.color" ng-value="'blue'" name="color" ng-disabled="$parent.formData.applyDisabled">gets disabled Blue</ion-radio> | ||
</div> | ||
</ion-content> | ||
<script> | ||
angular.module('ionicApp', ['ionic']) | ||
.controller('MainCtrl', function($scope) { | ||
|
||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
describe('ionRadio directive', function() { | ||
var compile, element, scope; | ||
|
||
beforeEach(module('ionic')); | ||
|
||
beforeEach(inject(function($compile, $rootScope, $timeout, $window) { | ||
compile = $compile; | ||
scope = $rootScope; | ||
timeout = $timeout; | ||
window = $window; | ||
ionic.Platform.setPlatform('Android'); | ||
spyOn(ionic.Platform, 'ready').andCallFake(function(cb) { | ||
cb(); | ||
}); | ||
})); | ||
it('passes ngDisabled attribute', function() { | ||
var element = compile('<ion-radio ng-disabled="true">')(scope); | ||
el = element[0].querySelector('input'); | ||
scope.$apply(); | ||
expect(el.disabled) | ||
.toBe(true); | ||
}); | ||
}); |