File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/** Simulate user events on react-select dropdowns */
22
33import {
4+ Matcher ,
45 findAllByText ,
56 findByText ,
67 fireEvent ,
7- Matcher ,
88 waitFor ,
99} from "@testing-library/dom" ;
1010
1111import act from "./act-compat" ;
1212
1313// find the react-select container from its input field 🤷
1414function getReactSelectContainerFromInput ( input : HTMLElement ) : HTMLElement {
15- // i hate this so much but older versions insist on inserting a space before their generated class name
16- let parent =
17- input . closest ( '[class^="css-"][class$="-container"]' ) ||
18- input . closest ( '[class^=" css-"][class$="-container"]' ) ;
19-
20- // for older versions of react-select fall back to old parent crawler
21- // istanbul ignore if
22- if ( ! parent ) {
23- parent = input . parentNode ! . parentNode ! . parentNode ! . parentNode !
24- . parentNode as HTMLElement ;
25- }
26-
27- return parent as HTMLElement ;
15+ return input . parentNode ! . parentNode ! . parentNode ! . parentNode !
16+ . parentNode as HTMLElement ;
2817}
2918
3019/**
@@ -116,7 +105,6 @@ interface CreateConfig extends Config {
116105 createOptionText ?: string | RegExp ;
117106 waitForElement ?: boolean ;
118107}
119-
120108/**
121109 * Utility for creating and selecting a value in a Creatable `react-select` dropdown.
122110 * @async
You can’t perform that action at this time.
0 commit comments