menu
Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# General Help
view-forward
# Angular Help
view-forward
# Cypress Help
view-forward
# DOM Help
view-forward
# React Help
view-forward
# Svelte Help
view-forward
# TestCafe Help
view-forward
# Vue Help
view-forward
Team
Posts
Members
Info

How to check that the correct option is selected?

I need to make sure that the current option is preselected in a certain situation. How can I achieve this? I might add an aria-selected="true", but how to query it?

thumbsup
0
message-simple
3

Querying a form element via getByRole('form')

I see due to this PR (https://github.com/testing-library/dom-testing-library/pull/446), that getByRole('form') will no longer work if the form doesn't have a name attribute. However, if you check the MDN docs for this, the name attirbute on forms is deprecated:…

thumbsup
0
message-simple
2

TypeError: document.createRange is not a function

Hi everyone, After upgrading to latest react-dom and react testing library run into these issues with my tests TypeError: document.createRange is not a function …

thumbsup
3
message-simple
2

react-bootstrap Form components lack attributes expected by jest-dom

My react-bootstrap Form components don't seem to end up with the precise attributes that jest-dom expects, when I use the Form props described in the react-bootstrap API. Example 1: <Form.Control isInvalid={true} /> renders …

thumbsup
0
message-simple
0

How to Jest/Unit Test a Component Reliant on a ref

I have a table which given the downloadRequested it will use the tableRef provided and return the sortedData within the table. When trying to add unit tests to make sure that the <CSVLink> is rendered on downloadRequested = true I keep hitting the below error: TypeError: Cannot…

thumbsup
0
message-simple
4

How can I test for multiple aria role="alert" errors in a form.

If I have a form that can have several alerts present How can I query for the specific errors and ensure they are within an alert role element? I want to do something like: …

thumbsup
1
message-simple
8

fireEvent.keyUp doesn't update the input value

Hello, I am trying to test that when a user types something in a form input, then if enables or disables a form submit button according to what's in the input. The problem is that when I fireEvent.keyUp, the input value is not updated to reflect the key that was passed. Here is…

thumbsup
0
message-simple
2

How to query button based on aria-selected and role='tab'

I have this kind of HTML. I can get both buttons using getAllByRole('tab'). Is there a way to get a button with aria-selected?

thumbsup
0
message-simple
0

Access elements in shadow root

Hey everyone, I have one question which came up during developing a component lately. Is it somehow possible to access shadow DOM elements with the test lib? Thanks!

thumbsup
0
message-simple
0
Deleted·131d# DOM Help

toHaveTextContent not exact matching.

toHaveTextContent matches on the content containing a value. I was getting false positives when testing that a value of 100 was passing when tested for a value of 10. I resorted to the following expect(countIndicator.textContent).toBe('10') and was interested to know if this was…

thumbsup
0
message-simple
1