-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
restore ability to instrument tests around <Link /> onClick
behavior outside routing context
#3635
Comments
|
That is a plug for teaspoon, by the way. |
I'm a bit new to Enzyme, so I'll look into the context injection, and I'll look into teaspoon too 😉 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Opening this issue as requested by @taion in #3572.
The issue is that the warning added to help prevent accidental rendering of
<Link />
s outside a router context obscures the results of tests aroundonClick
behavior. For example, both the following tests (where<Link />
is being rendered inside the<Nav />
component) will now result inclickHandler.callCount
being 0, so I can't test the difference in behavior depending on thehidden
prop:A summary of the solutions suggested via discussion in #3572:
NODE_ENV=testing
(but this has the disadvantage of not catching some bugs in tests, plus usingNODE_ENV=testing
is not all that common)onClick
(This gets my vote! I'm already usingpreventDefault
, so that part's not an issue.)The text was updated successfully, but these errors were encountered: