github testing-library/dom-testing-library v7.17.0

latest releases: v10.0.0, v10.0.0-alpha.3, v9.3.4...
3 years ago

7.17.0 (2020-06-23)

Features

  • waitFor: add complete support for fake timers (#662) (5b2640a), closes #661

🚨 It's possible this will break your tests if you were working around our limitations before. Fixing the issue should be straightforward. Here's an example from my (Kent's) own workaround:

  // using fake timers to skip debounce time
  jest.useFakeTimers()
  userEvent.clear(notesTextarea)
  userEvent.type(notesTextarea, newNotes)
- act(() => jest.runAllTimers())

  await screen.findByLabelText(/loading/i)
  // wait for the loading spinner to go away
  await waitForLoadingToFinish()

  jest.useRealTimers()

Notice that all I needed to change was removing manually advancing timers because now we handle things automatically for you 🎉

Don't miss a new dom-testing-library release

NewReleases is sending notifications on new releases.