diff --git a/src/dom/components/ReactDOMInput.js b/src/dom/components/ReactDOMInput.js index fce25d7cdc..12521b833c 100644 --- a/src/dom/components/ReactDOMInput.js +++ b/src/dom/components/ReactDOMInput.js @@ -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 }; }, diff --git a/src/dom/components/__tests__/ReactDOMInput-test.js b/src/dom/components/__tests__/ReactDOMInput-test.js index ea42b4e5a0..0ff9ee05f1 100644 --- a/src/dom/components/__tests__/ReactDOMInput-test.js +++ b/src/dom/components/__tests__/ReactDOMInput-test.js @@ -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 = ; + 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() {