-
-
Notifications
You must be signed in to change notification settings - Fork 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
simulate('click') on child component does not propagate to trigger blur on parent #1551
Comments
Because you've provided pseudocode, I can't be sure - can you provide the real code? |
@ljharb sure thing! Just updated with minimally reproducible example. |
@ljharb Any thoughts after seeing the real code? |
@jamesopti yes. one problem is that you're using arrow functions in class properties, which you should never do for many reasons. Specifically here, you can't mock them out in tests (altho this might be a red herring). Separately, I'd suggest avoiding |
API
Version
Adapter
I have a simple dropdown component that I'm having trouble regression testing.
In Dropdown.js below, a bug was introduced which broke children's click handlers.
The onBlur event on the parent fires before the click event in the child, despite being triggered by the child click. This resulted in the child being destroyed and its clicks not being registered.
(the bug was removing the onMouseOver/onMouseLeave handlers, which set state that onBlur uses)
Enzyme tests didn't catch this because they triggered a click directly in one
of the children, circumventing the event propagation of the blur.
Is there a better way to test this using enzyme?
Dropdown.js
test.js
Updated with minimally reproducible actual code
The text was updated successfully, but these errors were encountered: