Merge pull request #488 from spicyj/gh-473

Make submit button default value appear correctly
This commit is contained in:
Paul O’Shannessy
2013-11-06 22:56:19 -08:00
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -55,7 +55,7 @@ var ReactDOMInput = ReactCompositeComponent.createClass({
var defaultValue = this.props.defaultValue;
return {
checked: this.props.defaultChecked || false,
value: defaultValue != null ? defaultValue : ''
value: defaultValue != null ? defaultValue : null
};
},
@@ -129,6 +129,15 @@ describe('ReactDOMInput', function() {
expect(node.value).toBe('0');
});
it('should not set a value for submit buttons unnecessarily', function() {
var stub = <input type="submit" />;
var node = renderTextInput(stub);
// The value shouldn't be '', or else the button will have no text; it
// should have the default "Submit" or "Submit Query" label
expect(node.hasAttribute('value')).toBe(false);
});
it('should control radio buttons', function() {
var RadioGroup = React.createClass({
render: function() {