From be7a79733bbfc1a7d0d52cc8894db9a6d9cf1e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20M=C3=BCller?= Date: Fri, 2 Feb 2018 22:02:42 +0100 Subject: [PATCH] Added one more test. --- src/Typeahead.spec.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Typeahead.spec.jsx b/src/Typeahead.spec.jsx index ffe3cfc..505cc4b 100644 --- a/src/Typeahead.spec.jsx +++ b/src/Typeahead.spec.jsx @@ -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(); + 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(); expect(wrapper.find('input').prop('value')).toEqual('label1');