react-select-event
Advanced tools
Comparing version 4.1.3 to 4.1.4
@@ -59,6 +59,10 @@ 'use strict'; | ||
const optionElement = await dom.findByText(container, option, { | ||
const matchingElements = await dom.findAllByText(container, option, { | ||
// @ts-ignore invalid rtl types :'( | ||
ignore: "[aria-live] *,[style*='visibility: hidden']" | ||
}); | ||
}); // When the target option is already selected, the react-select display text | ||
// will also match the selector. In this case, the actual dropdown element is | ||
// positionned last in the DOM tree. | ||
const optionElement = matchingElements[matchingElements.length - 1]; | ||
dom.fireEvent.click(optionElement); | ||
@@ -65,0 +69,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { fireEvent, findByText, wait } from '@testing-library/dom'; | ||
import { fireEvent, findAllByText, findByText, wait } from '@testing-library/dom'; | ||
@@ -55,6 +55,10 @@ /** Simulate user events on react-select dropdowns */ | ||
const optionElement = await findByText(container, option, { | ||
const matchingElements = await findAllByText(container, option, { | ||
// @ts-ignore invalid rtl types :'( | ||
ignore: "[aria-live] *,[style*='visibility: hidden']" | ||
}); | ||
}); // When the target option is already selected, the react-select display text | ||
// will also match the selector. In this case, the actual dropdown element is | ||
// positionned last in the DOM tree. | ||
const optionElement = matchingElements[matchingElements.length - 1]; | ||
fireEvent.click(optionElement); | ||
@@ -61,0 +65,0 @@ } |
{ | ||
"name": "react-select-event", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "Simulate react-select events for react-testing-library", | ||
@@ -5,0 +5,0 @@ "main": "lib/react-select-event.cjs.js", |
/** Simulate user events on react-select dropdowns */ | ||
import { fireEvent, findByText, wait } from "@testing-library/dom"; | ||
import { | ||
fireEvent, | ||
findByText, | ||
findAllByText, | ||
wait | ||
} from "@testing-library/dom"; | ||
@@ -68,6 +73,11 @@ // find the react-select container from its input field 🤷 | ||
// only consider visible, interactive elements | ||
const optionElement = await findByText(container, option, { | ||
const matchingElements = await findAllByText(container, option, { | ||
// @ts-ignore invalid rtl types :'( | ||
ignore: "[aria-live] *,[style*='visibility: hidden']" | ||
}); | ||
// When the target option is already selected, the react-select display text | ||
// will also match the selector. In this case, the actual dropdown element is | ||
// positionned last in the DOM tree. | ||
const optionElement = matchingElements[matchingElements.length - 1]; | ||
fireEvent.click(optionElement); | ||
@@ -74,0 +84,0 @@ } |
Sorry, the diff of this file is not supported yet
40997
749