Skip to content

Update testing-library/user-event to latest version#6231

Merged
aduth merged 1 commit intomainfrom
aduth-upgrade-user-event
Apr 21, 2022
Merged

Update testing-library/user-event to latest version#6231
aduth merged 1 commit intomainfrom
aduth-upgrade-user-event

Conversation

@aduth
Copy link
Contributor

@aduth aduth commented Apr 21, 2022

Why: Since there are many improvements, bug fixes, and (importantly, for future reference) breaking changes.

Major release changelogs:

I had originally hoped to do a single pass at updating all of the @testing-library/ dependencies, but it's turning out to be a more painful upgrade than I'd anticipated, so I'll be doing it piecemeal.

Noteworthy upgrade remarks:

  • Most userEvent actions are asynchronous, and usually incur a frame tick
    • The frame tick interferes with Sinon fake timers, since fake timers will pause all timeouts. Fortunately, a new built-in advanceTimers option allows the delay to increment the fake timers
  • The latest version no longer includes keyCode or which in keyboard events. While these properties are technically deprecated, they are implemented in most browsers and used by many third-party libraries for improved backwards compatibility
    • This is the reason for some of the removal of some tested behaviors in PersonalKeyInput specs, since cleave.js relies on keyCode
  • userEvent.upload against selfie fields is no longer possible because the user-facing behavior of selfie images is to prevent uploaded images. Previously this was not enforced by userEvent, but it is now. Instead, we fire the change event directly.
  • userEvent.upload did not previously test the input's accept property. In fact, I'd previously reported this upstream. At the time, it was regarded as working as intended due to browser-allowable circumvention. Now, the default behavior checks accept. Since it is still possible to circumvent, we opt-out via applyAccept for test cases where we were intentionally testing against the circumvention behavior.
  • userEvent.type now uses standard KeyboardEvent#key values (e.g. {esc} -> {Escape})

**Why**: Since there are many improvements, bug fixes, and (importantly, for future reference) breaking changes.

changelog: Internal, Dependencies, Update dependencies
@aduth aduth merged commit e855581 into main Apr 21, 2022
@aduth aduth deleted the aduth-upgrade-user-event branch April 21, 2022 13:11
@jmdembe jmdembe mentioned this pull request Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants