enzyme
enzyme copied to clipboard
Fix ref on root component pointing to internal component
When using mount(<div ref={React.createRef()} />)
ref.current
was pointing to an internal wrapper component.
Previous workarounds:
-
mount(<><div ref={React.createRef()} /></>)
-
mount(<div />).instance()
Both workarounds require knowledge of either enzymes API (2) or internals (1). Making this just™ work should be preferred IMO.
When I opened this I didn't realize how many moving parts are involved for this. Since this already has two workarounds I'm not that motivated to spend more hours on this fix.
Since I won't work on this I'm closing for now. Feel free to reopen and finish the work required to get this merged.