diff --git a/src/Input.js b/src/Input.js index ff224e3456..52dc202ee8 100644 --- a/src/Input.js +++ b/src/Input.js @@ -245,7 +245,12 @@ const Input = React.createClass({ ]; } - return {children}; + if (this.props.type === 'submit') { + let {bsStyle, ...other} = this.props; /* eslint no-unused-vars: 0 */ + return {children}; + } else { + return {children}; + } } }); diff --git a/test/InputSpec.js b/test/InputSpec.js index 9795a5ea03..e0f6e60f80 100644 --- a/test/InputSpec.js +++ b/test/InputSpec.js @@ -40,7 +40,7 @@ describe('Input', function () { assert.equal(instance.getValue(), 'v'); }); - it.skip('renders a submit button element when type=submit', function () { + it('renders a submit button element when type=submit', function () { let instance = ReactTestUtils.renderIntoDocument( ); @@ -50,6 +50,24 @@ describe('Input', function () { assert.equal(node.getAttribute('class'), 'btn btn-danger'); }); + it('must not throw warning when bsStyle=danger and type=submit', function () { + ReactTestUtils.renderIntoDocument( + + ); + + console.warn.called.should.be.false; + }); + + it('throws warning about wrong type for bsStyle=error when type=submit', function () { + ReactTestUtils.renderIntoDocument( + + ); + + console.warn.called.should.be.true; + console.warn.calledWithMatch('propType: Invalid').should.be.true; + console.warn.reset(); // reset state for afterEach() + }); + it('renders a p element when type=static', function () { let instance = ReactTestUtils.renderIntoDocument(