Skip to content

Commit

Permalink
Merge pull request react-bootstrap#514 from AlexKVal/fix507
Browse files Browse the repository at this point in the history
[fixed] Fix for react-bootstrap#507
  • Loading branch information
mtscout6 committed Apr 23, 2015
2 parents d7fe8bf + bc8cd5c commit feb0752
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/Input.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,12 @@ const Input = React.createClass({
];
}

return <FormGroup {...this.props}>{children}</FormGroup>;
if (this.props.type === 'submit') {
let {bsStyle, ...other} = this.props; /* eslint no-unused-vars: 0 */
return <FormGroup {...other}>{children}</FormGroup>;
} else {
return <FormGroup {...this.props}>{children}</FormGroup>;
}
}
});

Expand Down
20 changes: 19 additions & 1 deletion test/InputSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<Input type="submit" bsStyle="danger" wrapperClassName='test' />
);
Expand All @@ -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(
<Input type="submit" bsStyle="danger" />
);

console.warn.called.should.be.false;
});

it('throws warning about wrong type for bsStyle=error when type=submit', function () {
ReactTestUtils.renderIntoDocument(
<Input type="submit" bsStyle="error" />
);

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(
<Input type="static" value="v" />
Expand Down

0 comments on commit feb0752

Please sign in to comment.