Permalink
Browse files

Re-added the focus() method on Select.Async

  • Loading branch information...
mcls committed Oct 27, 2016
1 parent dfe4119 commit ba2bd5e822e2ae2d53f73ea0a748b5b9166e8c82
Showing with 17 additions and 0 deletions.
  1. +4 −0 src/Async.js
  2. +13 −0 test/Async-test.js
View
@@ -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;
View
@@ -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);
});
});
});

0 comments on commit ba2bd5e

Please sign in to comment.