diff --git a/src/Async.js b/src/Async.js index 17e949db0d..411a7eacd2 100644 --- a/src/Async.js +++ b/src/Async.js @@ -176,6 +176,10 @@ export default class Async extends Component { return searchPromptText; } + focus () { + this.select.focus(); + } + render () { const { children, loadingPlaceholder, placeholder } = this.props; const { isLoading, options } = this.state; diff --git a/test/Async-test.js b/test/Async-test.js index c49e60b5ba..8742e315ff 100644 --- a/test/Async-test.js +++ b/test/Async-test.js @@ -434,4 +434,17 @@ describe('Async', () => { return expect(onInputChange, 'was called times', 1); }); }); + + describe('.focus()', () => { + beforeEach(() => { + createControl({}); + }); + + it('focuses the search input', () => { + var input = asyncNode.querySelector('input'); + expect(input, 'not to equal', document.activeElement); + asyncInstance.focus(); + expect(input, 'to equal', document.activeElement); + }); + }); });