Skip to content

Commit

Permalink
Added one more test.
Browse files Browse the repository at this point in the history
  • Loading branch information
visusnet committed Feb 2, 2018
1 parent 408a6d6 commit be7a797
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Typeahead.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ describe('Typeahead should', () => {
expect(wrapper.state('isOpen')).toBe(false);
});

it('close menu on focus lost with unknown value', () => {
const wrapper = mount(<Typeahead fieldName="fieldName" allowUnknownValue={true} options={options}/>);
simulateKeys(wrapper.find('input'), 'unknown');
wrapper.find('input').simulate('focus');
wrapper.find('input').simulate('blur');

expect(wrapper.state('isOpen')).toBe(false);
});

it('accept value from props when value is known from options', () => {
const wrapper = mount(<Typeahead fieldName="fieldName" options={options} value="value1"/>);
expect(wrapper.find('input').prop('value')).toEqual('label1');
Expand Down

0 comments on commit be7a797

Please sign in to comment.