-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
FormTokenField: use KeyboardEvent.code, refactor tests to model RTL and user-event #43442
Conversation
Size Change: +5 B (0%) Total Size: 1.24 MB
ℹ️ View Unchanged
|
432d5c1
to
fed3197
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in love with the way you write tests: elegant, eloquent, thorough, well-described, and easy to follow ❤️ Thanks a lot for your brilliant work here! 💯
I've left a few suggestions, but it's just minor optional stuff, this already looks ready to go.
🚀 🚢
a068b32
to
94e42d9
Compare
Thank you for your review, I'm humbled 🙇 All feedback has been addressed, will wait for CI to ✅ and merge |
Co-authored-by: Marin Atanasov <[email protected]>
Co-authored-by: Marin Atanasov <[email protected]>
94e42d9
to
9435de3
Compare
What?
FormTokenField
component to rely oncode
instead ofkeyCode
for keyboard events.fireEvent
, I went ahead and rewrote the whole test suite in TypeScript, usinguserEvent
and with "modern" RTL style (i.e. avoiding implementation details).__experimentalExpandOnFocus
actually made the suggestions always visible (not just when focused)__experimentalAutoSelectFirstMatch
's value changedOn top of that, here's list of things that I noticed and could be improved:
autoComplete
prop is listed as a value accepted by the component, but it doesn't seem to have any impact (since it gets overridden tooff
)listbox
element can be rendered even if there are no suggestions passed via prop (for example, if the__experimentalExpandOnFocus
is true and the component gets focused)title
attribute set)__experimentalRenderSuggestion
would probably be a better name for__experimentalRenderItem
, and shoudl it allow for extra props?Why?
keyCode
is deprecated, and replaced bycode
We're also rewriting our unit tests to RTL