I'm trying to use waitForElementToBeRemoved with just an element but Jest is timing out. When I pass in a function, it works.
My understanding from this feature was that it should be able to take an element: https://github.com/testing-library/dom-testing-library/pull/460
I verified my app is using @testing-library/dom@7.8.0.
Here's the code:
// doesn't work
await waitForElementToBeRemoved(screen.getByText("Loading..."));
// works
await waitForElementToBeRemoved(() => screen.getByText("Loading..."));
Any idea what I'm doing wrong?