Skip to content

Commit

Permalink
fix: Correct pass custom properties into Input component. close #73
Browse files Browse the repository at this point in the history
  • Loading branch information
jessy1092 committed Sep 6, 2016
1 parent 823c3b1 commit 610d8e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/elements/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Basic = React.createClass({

render: function () {

const { props: { children, placeholder, type, ...other } } = this;
const { props: { className, children, ...other } } = this;

if (typeof children != 'undefined') {
return (
Expand All @@ -21,10 +21,8 @@ const Basic = React.createClass({
);
} else {
return (
<div {...other}>
<input
placeholder={placeholder}
type={type}/>
<div className={className}>
<input {...other}/>
</div>
)
}
Expand Down
11 changes: 11 additions & 0 deletions test/__tests__/elements/Input-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ describe('Input', () => {
expect(ReactDOM.findDOMNode(input).getAttribute('type')).toMatch('text');
});

it('should have value for button type', () => {

let instance = TestUtils.renderIntoDocument(
<Input type="button" value="Submit..."></Input>
);

let input = TestUtils.findRenderedDOMComponentWithTag(instance, 'input');

expect(ReactDOM.findDOMNode(input).getAttribute('value')).toMatch('Submit...');
});

it('should display Input name', () => {
let Component = (
<Input></Input>
Expand Down

0 comments on commit 610d8e9

Please sign in to comment.