From b8ee3018b56853f86c1cb19c46b7da2952bb35d8 Mon Sep 17 00:00:00 2001 From: Brandy Carney Date: Fri, 3 Feb 2017 11:52:42 -0500 Subject: [PATCH] fix(toggle/checkbox): allow value to be programmatically updated while disabled (#10304) fixes #9730 --- src/components/checkbox/checkbox.ts | 2 +- src/components/checkbox/test/basic/app.module.ts | 3 +++ src/components/checkbox/test/basic/main.html | 16 ++++++++++++++++ src/components/toggle/toggle.ts | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/checkbox/checkbox.ts b/src/components/checkbox/checkbox.ts index 0d72dc7bfd..5e704bf46b 100644 --- a/src/components/checkbox/checkbox.ts +++ b/src/components/checkbox/checkbox.ts @@ -158,7 +158,7 @@ export class Checkbox extends Ion implements IonicTapInput, AfterContentInit, Co * @private */ _setChecked(isChecked: boolean) { - if (!this._disabled && isChecked !== this._checked) { + if (isChecked !== this._checked) { this._checked = isChecked; if (this._init) { this.ionChange.emit(this); diff --git a/src/components/checkbox/test/basic/app.module.ts b/src/components/checkbox/test/basic/app.module.ts index cdf15e9cc5..58b4291169 100644 --- a/src/components/checkbox/test/basic/app.module.ts +++ b/src/components/checkbox/test/basic/app.module.ts @@ -27,6 +27,9 @@ export class E2EPage { 'grape': this.grapeCtrl }); + public checked: boolean = false; + public disabled: boolean = false; + constructor() { this.grapeChecked = true; this.standAloneChecked = true; diff --git a/src/components/checkbox/test/basic/main.html b/src/components/checkbox/test/basic/main.html index 5373529bd2..332c05c012 100644 --- a/src/components/checkbox/test/basic/main.html +++ b/src/components/checkbox/test/basic/main.html @@ -88,4 +88,20 @@ + + Checkbox / Toggle + + + + + checked + + + + + disabled + + + + diff --git a/src/components/toggle/toggle.ts b/src/components/toggle/toggle.ts index 3421c8a9b6..9fcfaaa136 100644 --- a/src/components/toggle/toggle.ts +++ b/src/components/toggle/toggle.ts @@ -229,7 +229,7 @@ export class Toggle extends Ion implements IonicTapInput, AfterContentInit, Cont * @private */ _setChecked(isChecked: boolean) { - if (!this._disabled && isChecked !== this._checked) { + if (isChecked !== this._checked) { this._checked = isChecked; if (this._init) { this.ionChange.emit(this);