Skip to content

Commit

Permalink
kg: add focus functionality to DateInput
Browse files Browse the repository at this point in the history
  • Loading branch information
buronnie committed Oct 12, 2017
1 parent f0e84b9 commit e5dda8e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/DateInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ export default class DateInput extends React.Component {
}
}

focus() {
this.inputEl.focus();
}

render() {
const { className, dateVisible, disabled, footer, header, showOnFocus } = this.props;
const { open } = this.state;
Expand Down
6 changes: 6 additions & 0 deletions test/components/DateInput.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,10 @@ describe('<DateInput />', () => {
mount(<DateInput parse={callback} defaultValue="1-2-3" dateFormat="MM-DD-YY" />);
assert(callback.calledWith('1-2-3', 'MM-DD-YY'));
});

it('should support focus', () => {
const wrapper = mount(<DateInput defaultValue="1/23/1983" />);
const component = wrapper.instance();
assert.equal(typeof component.focus, 'function');
});
});

0 comments on commit e5dda8e

Please sign in to comment.