mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #488 from spicyj/gh-473
Make submit button default value appear correctly
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user