-
Notifications
You must be signed in to change notification settings - Fork 249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework type #581
Rework type #581
Conversation
Codecov Report
@@ Coverage Diff @@
## master #581 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 13 47 +34
Lines 728 855 +127
Branches 232 323 +91
==========================================
+ Hits 728 855 +127
Continue to review full report at Codecov.
|
@adamayres The rewrite is complete. All previous tests (apart from a) a bug and b) an unlogic edge case) pass. |
What:
This PR will include a complete rewrite of
userEvent.type
to tackle the issues tracked in #521There are a lot of changes and some of the fixes along the way might break code that considered these bugs features. So a major version update should happen.
With the changes
userEvent.type
will actually return no Promise if there is nodelay
.The newly introduces
userEvent.keyboard
skips all convenience ofuserEvent.type
and just applies the key events on the active element.It allows to apply events and continue with a keyboard state.
user-event/src/__tests__/keyboard/index.ts
Lines 111 to 137 in b8a78c8
Why:
userEvent.type
currently is a patchwork of specialized implementations for edge cases.We've got a bunch of open issues that nobody wants to tackle because it is unclear where exactly a change should be implemented and if there are more things to consider.
The code lacks structure and documentation.
The conversion to Typescript highlighted a lot of hidden debt inside the code regarding assumptions about return values passed around without further checks.
How:
utils
andtype
into multiple files and convert to Typescript to improve confidence in upcoming changestypeImplementation
to provide a shared internal API to extend for special characters, meta characters, etcChecklist: