-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Select] React Testing Library does not find select event on VaSelect component #671
Comments
We'd like to address this by updating the component to use the native change event. |
Update on PR: I have been unable to observe the This code allows you to select a new value using const select = await screen.findByTestId('providersSelect');
userEvent.selectOptions(select, 'Two');
expect(screen.getByRole('option', { name: 'Two' }).selected).to.equal(true); This throws a fireEvent.change(select, { target: { value: 'Two' } }); Related Issuestesting-library/dom-testing-library#413 |
Moving this to Icebox to look at a later time |
Closing as this is old and the VADS has been updated. If there is still an issue file a new request. |
What happened
In a recent ticket we upgraded VAOS to use the new VaSelect web component from the VA component library. We came across an issue/concern in our unit testing of this component using RTL (React testing Library). We are not able to use RTL’s native select feature because the VaSelect web component is rendered within a shadow dom.
Below is a snippet of our solution to trigger the event
What I expected to happen
To use RTL's click method on the select component.
This is the line of code that was replaced when we refactored to the new component.
userEvent.click(await screen.findByText(/use your current location/i));
The text was updated successfully, but these errors were encountered: