menu

Testing Library

Simple and complete DOM testing utilities that encourage good testing practices.

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
# TestCafe Help
view-forward
# Vue Help
view-forward
Team
Posts
Members
Info

Testing hooks that use setInterval using fake timers

I'm looking for a cleaner way to test my countdown component. I'm using the setInterval hook posted by Dan Abramov[1]. The count starts at 10 and in my test I want to advance the timer 11 seconds and see that the count is now at 0. I call jest.useFakeTimers(), render the…

thumbsup
1
message-simple
1
Deleted·5d# General Help

Simple fireEvent.click not working

Hi, I have a dead simple click handler test which is not working. Component Test …

thumbsup
0
message-simple
14

Testing animationend

Trying to test a method for removing an element from the page. The element is removed from the page after a css animation has finished. Haven't been able to find how to test for the element being removed after the animation has completed. Here is the method for removing the…

thumbsup
0
message-simple
6

How can I fireEvent a <Select /> component from Ant Design?

The <Select> component does not render an actual select element as far as I know. So how can I fireEvent something like that? Given a Select element and a submit button. The button is disabled until the user changes the value of the Select element. And I want to test it with…

thumbsup
1
message-simple
8

RTL & jsdom - How to scroll down to test sticky header text shows up?

Hi friends! Has anyone had experience firing off a scroll event in RTL & jsdom and have it work properly in their integration tests?

thumbsup
0
message-simple
0

RTL utility types when using a custom function and TypeScript

Hi, I wondering what should the return type be (instead of generic : any) for the utilities returned by RTL. For example, with the following, I get TS error (Unexpected any. Specify a different type.)

thumbsup
0
message-simple
0

Testing a component renders on parent hover

I'm trying to test that a component renders when hovering on another component. This requires mocking a mouse enter event but I couldn't find any examples. I saw other threads that talk about not needing to test CSS styles and hover effects. I don't believe that's the case here…

thumbsup
0
message-simple
3

How can i do a full render in a component?

Hi Guys, i'm having troubles trying to find a element in the DOM, because this component has a lot of nodes and i notice that render function has a limit with the amount of nodes that it prints, do you know if there're a way to make a full render of a component? Thanks so much…

thumbsup
0
message-simple
5

Error when using `typescript` && `toBeInTheDocument`

Hey folks, I'm trying to test one of my compoents, but I keep getting the following error: component I'm trying to test: Thanks in advance

thumbsup
0
message-simple
5

Is there a way to query only a subset of the React component rendered?

So, I have a Table component. It queries the DB and renders multiple rows. The Row component itself is comprised of multiple buttons. Those buttons are present on each row so getByText or getByTestId can't be used. What would be the best case to test a single row in this case?

thumbsup
0
message-simple
3