Skip to content
Browse files

Merge pull request #2197 from ibolmo/fix-2164-element-falsey-value

Fixes #2164.
  • Loading branch information...
2 parents bf35c9f + 0b42256 commit d05c9fb9fdf7371ebb2429c1e2443085e653f1bd @cpojer cpojer committed
Showing with 6 additions and 1 deletion.
  1. +1 −1 Source/Element/Element.js
  2. +5 −0 Specs/1.4client/Element/Element.js
View
2 Source/Element/Element.js
@@ -568,7 +568,7 @@ Object.append(propertySetters, {
},
'value': function(node, value){
- node.value = value || '';
+ node.value = (value != null) ? value : '';
}
});
View
5 Specs/1.4client/Element/Element.js
@@ -37,6 +37,11 @@ describe('Element', function(){
expect(new Element('input', {value: value}).get('value')).toEqual('');
});
+ it('should set a falsey value and not an empty string', function(){
+ expect(new Element('input', {value: false}).get('value')).toEqual('false');
+ expect(new Element('input', {value: 0}).get('value')).toEqual('0');
+ });
+
});
describe('type', function(){

0 comments on commit d05c9fb

Please sign in to comment.
Something went wrong with that request. Please try again.