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

Function findSelection

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

Source from the content-addressed store, hash-verified

33}
34
35export function findSelection(wrapper: any, index: number = 0) {
36 if (wrapper instanceof HTMLElement) {
37 const itemNode = wrapper.querySelectorAll('.rc-select-selection-item')[index];
38 const contentNode = itemNode.querySelector('.rc-select-selection-item-content');
39
40 if (contentNode) {
41 return contentNode;
42 }
43
44 return itemNode;
45 } else {
46 const itemNode = wrapper.find('.rc-select-selection-item').at(index);
47 const contentNode = itemNode.find('.rc-select-selection-item-content');
48
49 if (contentNode.length) {
50 return contentNode;
51 }
52
53 return itemNode;
54 }
55}
56
57export function removeSelection(wrapper: any, index: number = 0) {
58 const preventDefault = jest.fn();

Callers 5

Select.test.tsxFile · 0.90
Tags.test.tsxFile · 0.90
Multiple.test.tsxFile · 0.90
maxTagTextLengthTestFunction · 0.90
dynamicChildrenTestFunction · 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…