Real fix for #444 with passing test

This commit is contained in:
Max Lynch
2014-01-20 18:13:37 -06:00
parent 734d03d1b9
commit 577b52fa11
4 changed files with 14 additions and 8 deletions

3
dist/js/ionic.js vendored
View File

@@ -5819,8 +5819,9 @@ ionic.views.TabBar = ionic.views.View.inherit({
},
tap: function(e) {
if(!this.el.disabled)
if(this.el.getAttribute('disabled') !== 'disabled') {
this.val( !this.checkbox.checked );
}
},
drag: function(e) {

View File

File diff suppressed because one or more lines are too long

View File

@@ -27,18 +27,22 @@ describe('Ionic Toggle', function() {
it('Should disable and enable', function() {
el = compile('<toggle ng-model="data.name" ng-disabled="isDisabled"></toggle>')(rootScope);
rootScope.data = { isDisabled: false };
el = compile('<toggle ng-model="data.name" ng-disabled="data.isDisabled"></toggle>')(rootScope);
var toggle = el.isolateScope().toggle;
expect(toggle.val()).toBe(false);
el.click();
expect(toggle.val()).toBe(true);
$rootScope.isDisabled = true;
rootScope.data.isDisabled = true;
rootScope.$apply();
expect(toggle.el.getAttribute('disabled')).toBe('disabled');
el.click();
expect(toggle.val()).toBe(true);
$rootScope.isDisabled = false;
rootScope.data.isDisabled = false;
rootScope.$apply();
el.click();
expect(toggle.val()).toBe(false);
expect(toggle.el.getAttribute('disabled')).not.toBe('disabled');
});
});

View File

@@ -10,8 +10,9 @@
},
tap: function(e) {
if(!this.el.disabled)
if(this.el.getAttribute('disabled') !== 'disabled') {
this.val( !this.checkbox.checked );
}
},
drag: function(e) {