-
-
Notifications
You must be signed in to change notification settings - Fork 2k
A nested ForwardRef is not recognized as a valid component by shallow dive() #1830
Copy link
Copy link
Closed
Description
Describe the bug
A nested ForwardRef is not recognized as a valid component when I do shallow dive() to it.
To Reproduce
Steps to reproduce the behavior:
- Sample code:
import * as React from "react";
import { shallow } from 'enzyme';
const Component = () => <div/>
const HOCOne = (WrappedComponent) => React.forwardRef(() => <WrappedComponent/>)
const HOCTwo = (WrappedComponent) => React.forwardRef(() => <WrappedComponent/>)
const WithNestedForwarRefComponent = HOCTwo(HOCOne(Component)))
const vDomWrapper = shallow(<WithNestedForwarRefComponent/>);
- Then debug() and dive() vDomWrapper:
vDomWrapper.debug()
vDomWrapper.dive()- Debug output:
<ForwardRef(HOCOne(Component)) /> - See dive() error:
TypeError: ShallowWrapper::dive() can only be called on components
Expected behavior
A ForwardRef component must be recognized as such and it must be possible to do dive () on it.
Desktop:
- OS: Ubuntu 18.04
- Node: 8.11.3
- Enzyme: 3.6.0
- React: 16.5.0
Reactions are currently unavailable