-
Notifications
You must be signed in to change notification settings - Fork 244
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
Feat request: Add blur #189
Comments
Why do you need this if I'm closing the issue but feel free to comment and we can reopen it we can come up with a good use case. |
Hi, I think should be good, all kind of interaction in only one package. |
We might move user-event to the main package at some point but for now, it's better to keep the separated |
great. |
Hey, hey guys :) Hope you're doing well! Why not just to move everything related to interactions to the user-event package and after it's ready to be merged with the main library - do it? IMO it's always great to have one common thing for one concrete purpose in terms of consistency. |
Please keep issues separate so we can find and reference them easily. |
fireEvent.blur() only triggers onBlur event, right? It doesn't actually remove focus from the element. We need userEvent.blur() that would actually behave realistically (trigger onBlur event and remove focus from the element) |
@ErlanBazarov |
Do not get me wrong, but I think that the code of "click somewhere else" will not be readable |
Why not? userEvent.click(document.body) // move the focus away |
Is it not semantic. Maybe it can be clear for who wrote it, but not for other developer or yourself in future. |
I'm sorry, but I fail to understand the issue or the proposed solution here. If you want to test against an implementation detail, i.e. the element.blur() So which abstraction should a |
I disagree. The user can perform the blur event pressing tab for instance. I think should be nice to have the If I do |
That is exactly the problem with such an API in this package. The user can trigger a So should your proposed The user could also press How do we determine the correct behavior? Currently our standard is to perform the action described by the API call in the browser. But I fail to see what the reference action in the browser should be that I would perform to determine if our implementation is correct. |
If Edit: Unfortunately, it looks like |
Hey, I've just stumbled upon this issue. What was the fix for me, without using |
This doesn't work for me. It just times out with user-event version 14. |
@ScubaDaniel In If you use fake timers in your test suits, have a look at https://testing-library.com/docs/user-event/options/#advancetimers |
Just to add the
fireEvent.blur()
:)
The text was updated successfully, but these errors were encountered: