From 704fe402e79b457150428856aa0b273986431779 Mon Sep 17 00:00:00 2001 From: Perry Govier Date: Fri, 27 Jun 2014 15:58:17 -0500 Subject: [PATCH] fix(radio): suport ng-disabled. Closes #1684 --- js/angular/directive/radio.js | 3 +- test/html/input-radio.html | 36 +++++++++++++++++++++++ test/unit/angular/directive/radio.unit.js | 23 +++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 test/html/input-radio.html create mode 100644 test/unit/angular/directive/radio.unit.js diff --git a/js/angular/directive/radio.js b/js/angular/directive/radio.js index af62bdc7569..292addbe66a 100644 --- a/js/angular/directive/radio.js +++ b/js/angular/directive/radio.js @@ -25,6 +25,7 @@ IonicModule scope: { ngModel: '=?', ngValue: '=?', + ngDisabled: '=?', ngChange: '&', icon: '@', name: '@' @@ -32,7 +33,7 @@ IonicModule transclude: true, template: '', diff --git a/test/html/input-radio.html b/test/html/input-radio.html new file mode 100644 index 00000000000..8a6af7578db --- /dev/null +++ b/test/html/input-radio.html @@ -0,0 +1,36 @@ + + + + + + Radio Buttons + + + + + + + + +

Radio Buttons

+
+ + + {{ $parent.formData }} +
+ + Apply Disabled + Enable + + gets disabled Red + gets disabled Blue +
+
+ + + \ No newline at end of file diff --git a/test/unit/angular/directive/radio.unit.js b/test/unit/angular/directive/radio.unit.js new file mode 100644 index 00000000000..b3f8ba60ea8 --- /dev/null +++ b/test/unit/angular/directive/radio.unit.js @@ -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('')(scope); + el = element[0].querySelector('input'); + scope.$apply(); + expect(el.disabled) + .toBe(true); + }); +}); \ No newline at end of file