From 8396600217587642631256eb3d9a51785e6934fd Mon Sep 17 00:00:00 2001 From: Sushant Kulkarni Date: Mon, 4 Dec 2017 21:21:52 +0530 Subject: [PATCH] added tests for fix #1020 and #2102 --- test/Select-test.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/test/Select-test.js b/test/Select-test.js index cb83002a9d..53d75abfed 100644 --- a/test/Select-test.js +++ b/test/Select-test.js @@ -3172,6 +3172,36 @@ describe('Select', () => { }); }); + describe('option onBlur returns non false value', () => { + it('menu should be closed', () => { + instance = createControl({ + options: defaultOptions, + onBlur: (e) => { + return true; + } + }); + + clickArrowToOpen(); + instance.handleInputBlur(); + expect( instance.state.isOpen, 'to be false'); + }); + }); + + describe('option onBlur returns false', () => { + it('menu must remain open', () => { + instance = createControl({ + options: defaultOptions, + onBlur: (e) => { + return false; + } + }); + + clickArrowToOpen(); + instance.handleInputBlur(); + expect( instance.state.isOpen, 'to be true'); + }); + }); + describe('onFocus', () => { var onFocus;