Skip to content

Commit

Permalink
Added test for closing menu when input is blurred
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Lane committed Feb 24, 2016
1 parent b8d1d9a commit cd70cea
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/__tests__/Autocomplete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,29 @@ describe('Autocomplete acceptance tests', () => {

it('should display autocomplete menu when input has focus', () => {

// Display autocomplete menu upon input focus
expect(autocompleteWrapper.state('isOpen')).to.be.false;
expect(autocompleteWrapper.instance().refs.menu).to.not.exist;

// Display autocomplete menu upon input focus
autocompleteInputWrapper.simulate('focus');

expect(autocompleteWrapper.state('isOpen')).to.be.true;
expect(autocompleteWrapper.instance().refs.menu).to.exist;
});

it('should close autocomplete menu when input is blurred', () => {

// Display autocomplete menu upon input focus
autocompleteInputWrapper.simulate('focus');
expect(autocompleteWrapper.state('isOpen')).to.be.true;
expect(autocompleteWrapper.instance().refs.menu).to.exist;

autocompleteInputWrapper.simulate('blur');

expect(autocompleteWrapper.state('isOpen')).to.be.false;
expect(autocompleteWrapper.instance().refs.menu).to.not.exist;
});

it('should show results when partial match is typed in', () => {

// Render autocomplete results upon partial input match
Expand Down

0 comments on commit cd70cea

Please sign in to comment.