From 87acc26a6ee3c58f2d7b04a658b5a80848896086 Mon Sep 17 00:00:00 2001 From: Matan Shavit Date: Mon, 19 Apr 2021 19:17:49 -0400 Subject: [PATCH 1/2] fix: select TagRender prop does not close dropdown when clicked when dropdown is open --- src/Selector/MultipleSelector.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Selector/MultipleSelector.tsx b/src/Selector/MultipleSelector.tsx index b3426edd0..b6f385717 100644 --- a/src/Selector/MultipleSelector.tsx +++ b/src/Selector/MultipleSelector.tsx @@ -127,7 +127,7 @@ const SelectSelector: React.FC = (props) => { ) { const onMouseDown = (e: React.MouseEvent) => { onPreventMouseDown(e); - onToggleOpen(true); + onToggleOpen(!open); }; return ( From 6f735315cf10788b0b75f4089a5cb966615e98a1 Mon Sep 17 00:00:00 2001 From: Matan Shavit Date: Mon, 19 Apr 2021 19:19:40 -0400 Subject: [PATCH 2/2] test: expect a second click on a custom tag to close the dropdown --- tests/Tags.test.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/Tags.test.tsx b/tests/Tags.test.tsx index 0902a9fd8..09127ea86 100644 --- a/tests/Tags.test.tsx +++ b/tests/Tags.test.tsx @@ -295,6 +295,9 @@ describe('Select.Tags', () => { expect(wrapper.find('span.A').text()).toBe('AA'); expect(onTagRender).toHaveBeenCalled(); expect(wrapper.find('.customize-tag')).toHaveLength(3); + + wrapper.find('span.A').simulate('mousedown'); + expectOpen(wrapper, false); }); it('disabled', () => {