MCPcopy Create free account
hub / github.com/react-component/select / removeSelection

Function removeSelection

tests/utils/common.ts:57–78  ·  view source on GitHub ↗
(wrapper: any, index: number = 0)

Source from the content-addressed store, hash-verified

55}
56
57export function removeSelection(wrapper: any, index: number = 0) {
58 const preventDefault = jest.fn();
59
60 if (wrapper instanceof HTMLElement) {
61 const ele = wrapper.querySelectorAll('.rc-select-selection-item-remove')[index];
62 const mouseDownEvent = createEvent.mouseDown(ele);
63 mouseDownEvent.preventDefault = preventDefault;
64
65 fireEvent(ele, mouseDownEvent);
66 fireEvent.click(wrapper.querySelectorAll('.rc-select-selection-item-remove')[index]);
67 } else {
68 wrapper
69 .find('.rc-select-selection-item')
70 .at(index)
71 .find('.rc-select-selection-item-remove')
72 .last()
73 .simulate('mousedown', { preventDefault })
74 .simulate('click');
75 }
76
77 expect(preventDefault).toHaveBeenCalled();
78}
79
80type Jest = typeof jest;
81

Callers 2

Multiple.test.tsxFile · 0.90
removeSelectedTestFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…