From dcb8e0767fbf0a7a55f3b0045fd01b2532ea5441 Mon Sep 17 00:00:00 2001
From: Vojta Jina
Date: Wed, 4 Apr 2012 08:12:39 -0700
Subject: fix(booleanAttrs): convert to boolean
jQuery's attr() does not handle 0 as false, when it comes to boolean attrs.---
test/ng/directive/booleanAttrDirSpecs.js | 12 ++++++++++++
1 file changed, 12 insertions(+)
(limited to 'test/ng')
diff --git a/test/ng/directive/booleanAttrDirSpecs.js b/test/ng/directive/booleanAttrDirSpecs.js
index aa84c1ae..d58ffced 100644
--- a/test/ng/directive/booleanAttrDirSpecs.js
+++ b/test/ng/directive/booleanAttrDirSpecs.js
@@ -23,6 +23,18 @@ describe('boolean attr directives', function() {
}));
+ it('should properly evaluate 0 as false', inject(function($rootScope, $compile) {
+ // jQuery does not treat 0 as false, when setting attr()
+ element = $compile('')($rootScope)
+ $rootScope.isDisabled = 0;
+ $rootScope.$digest();
+ expect(element.attr('disabled')).toBeFalsy();
+ $rootScope.isDisabled = 1;
+ $rootScope.$digest();
+ expect(element.attr('disabled')).toBeTruthy();
+ }));
+
+
it('should bind disabled', inject(function($rootScope, $compile) {
element = $compile('')($rootScope)
$rootScope.isDisabled = false;
--
cgit v1.2.3