You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
In tests, if the component passed to root.findByType was created using forwardRef it can't be found.
If I use root.find to loop over all the nodes and log .type I see that the ref-forwarding-component is skipped entirely.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
I expect the second test to work like the first, however the second test is failing.
What is the expected behavior?
This may just be the way that forwardRef works, but the reason I expected it to work is I'm using it to make wrapped controls, like the <FancyButton> example from the documentation. When writing tests I want to be able to find a FancyButton and test it's besing passed the correct props, and not have to check that the DOM rendered by FancyButton is correct; that's already being tested in fancy-button.test.js
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Using React 16.3.2, failing in Chrome and Node 8.11.0
I've tried all the 16.3.x versions in codesandbox and they all failed.
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
In tests, if the component passed to
root.findByType
was created usingforwardRef
it can't be found.If I use
root.find
to loop over all the nodes and log.type
I see that the ref-forwarding-component is skipped entirely.If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
https://codesandbox.io/s/k0o70vjv07?module=%2Fsrc%2Findex.test.js
I expect the second test to work like the first, however the second test is failing.
What is the expected behavior?
This may just be the way that
forwardRef
works, but the reason I expected it to work is I'm using it to make wrapped controls, like the<FancyButton>
example from the documentation. When writing tests I want to be able to find aFancyButton
and test it's besing passed the correct props, and not have to check that the DOM rendered byFancyButton
is correct; that's already being tested infancy-button.test.js
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
Using React 16.3.2, failing in Chrome and Node 8.11.0
I've tried all the
16.3.x
versions in codesandbox and they all failed.The text was updated successfully, but these errors were encountered: