Skip to content

Commit 00c513b

Browse files
committed
Revert "Dynamically get react-select parent (#86)"
This reverts commit 3a162ab.
1 parent 0bfb64d commit 00c513b

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

src/index.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
11
/** Simulate user events on react-select dropdowns */
22

33
import {
4+
Matcher,
45
findAllByText,
56
findByText,
67
fireEvent,
7-
Matcher,
88
waitFor,
99
} from "@testing-library/dom";
1010

1111
import act from "./act-compat";
1212

1313
// find the react-select container from its input field 🤷
1414
function 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

0 commit comments

Comments
 (0)