diff --git a/packages/sn-pickers-react/src/components/search-picker.tsx b/packages/sn-pickers-react/src/components/search-picker.tsx index 42999cfa7..158250c57 100644 --- a/packages/sn-pickers-react/src/components/search-picker.tsx +++ b/packages/sn-pickers-react/src/components/search-picker.tsx @@ -73,6 +73,7 @@ export function SearchPicker {props.items.map((item) => (
onCheckedChangeHandler(e, item as any)} onDoubleClick={(e) => e.stopPropagation()} key={item.Id}> diff --git a/packages/sn-pickers-react/tests/search-picker.test.tsx b/packages/sn-pickers-react/tests/search-picker.test.tsx index 7d3a54888..7d1aa4abe 100644 --- a/packages/sn-pickers-react/tests/search-picker.test.tsx +++ b/packages/sn-pickers-react/tests/search-picker.test.tsx @@ -30,7 +30,7 @@ describe('Search picker component', () => { expect(wrapper.findWhere((node) => node.name() === 'input' && node.prop('checked') === true)).toHaveLength(1) }) - it('should handle selection on click', async () => { + it('should handle selection on click', async () => { let wrapper: any await act(async () => { wrapper = mount( @@ -46,6 +46,24 @@ describe('Search picker component', () => { }) expect(wrapper.findWhere((node) => node.name() === 'input' && node.prop('checked') === true)).toHaveLength(1) + + //Double click should not change the selection + + await act(async () => { + await wrapper.find(ListItem).at(3).simulate('dblclick') + wrapper.update() + }) + + expect(wrapper.findWhere((node) => node.name() === 'input' && node.prop('checked') === true)).toHaveLength(1) + + //parent Double Click should not change the selection + + await act(async () => { + await wrapper.find(ListItem).at(3).closest("[data-testid='search-list-item-container']").simulate('dblclick') + wrapper.update() + }) + + expect(wrapper.findWhere((node) => node.name() === 'input' && node.prop('checked') === true)).toHaveLength(1) }) it('should handle multiple selection', async () => {