react-select-event
Advanced tools
Comparing version 5.4.0 to 5.5.0
@@ -32,11 +32,3 @@ 'use strict'; | ||
function getReactSelectContainerFromInput(input) { | ||
// i hate this so much but older versions insist on inserting a space before their generated class name | ||
let parent = input.closest('[class^="css-"][class$="-container"]') || input.closest('[class^=" css-"][class$="-container"]'); // for older versions of react-select fall back to old parent crawler | ||
// istanbul ignore if | ||
if (!parent) { | ||
parent = input.parentNode.parentNode.parentNode.parentNode.parentNode; | ||
} | ||
return parent; | ||
return input.parentNode.parentNode.parentNode.parentNode.parentNode; | ||
} | ||
@@ -43,0 +35,0 @@ /** |
@@ -28,11 +28,3 @@ import { fireEvent, waitFor, findAllByText, findByText } from '@testing-library/dom'; | ||
function getReactSelectContainerFromInput(input) { | ||
// i hate this so much but older versions insist on inserting a space before their generated class name | ||
let parent = input.closest('[class^="css-"][class$="-container"]') || input.closest('[class^=" css-"][class$="-container"]'); // for older versions of react-select fall back to old parent crawler | ||
// istanbul ignore if | ||
if (!parent) { | ||
parent = input.parentNode.parentNode.parentNode.parentNode.parentNode; | ||
} | ||
return parent; | ||
return input.parentNode.parentNode.parentNode.parentNode.parentNode; | ||
} | ||
@@ -39,0 +31,0 @@ /** |
{ | ||
"name": "react-select-event", | ||
"version": "5.4.0", | ||
"version": "5.5.0", | ||
"description": "Simulate react-select events for react-testing-library", | ||
@@ -52,3 +52,3 @@ "main": "lib/react-select-event.cjs.js", | ||
"@types/react": "^17.0.0", | ||
"@types/react-select": "^4.0.13", | ||
"@types/react-select": "^5.0.1", | ||
"jest": "^27.0.4", | ||
@@ -55,0 +55,0 @@ "prettier": "^2.0.2", |
/** Simulate user events on react-select dropdowns */ | ||
import { | ||
Matcher, | ||
findAllByText, | ||
findByText, | ||
fireEvent, | ||
Matcher, | ||
waitFor, | ||
@@ -15,15 +15,4 @@ } from "@testing-library/dom"; | ||
function getReactSelectContainerFromInput(input: HTMLElement): HTMLElement { | ||
// i hate this so much but older versions insist on inserting a space before their generated class name | ||
let parent = | ||
input.closest('[class^="css-"][class$="-container"]') || | ||
input.closest('[class^=" css-"][class$="-container"]'); | ||
// for older versions of react-select fall back to old parent crawler | ||
// istanbul ignore if | ||
if (!parent) { | ||
parent = input.parentNode!.parentNode!.parentNode!.parentNode! | ||
.parentNode as HTMLElement; | ||
} | ||
return parent as HTMLElement; | ||
return input.parentNode!.parentNode!.parentNode!.parentNode! | ||
.parentNode as HTMLElement; | ||
} | ||
@@ -120,3 +109,2 @@ | ||
} | ||
/** | ||
@@ -123,0 +111,0 @@ * Utility for creating and selecting a value in a Creatable `react-select` dropdown. |
51501
956