-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Ref incorrectly set for HTMLElement #2253
Copy link
Copy link
Closed
Description
Current behavior
In react,
Refs for node elements are the underlying DOM HTMLElement,
Refs for Components are the Component instance.
When using Enzyme and mounting an html node element, the ref is not an HTMLElement
Expected behavior
The expected behaviour is to be on par with React, it shouldn't behave differently, the ref should be the element itself.
Your environment
Node 12.4
Mac OSx Sierra
API
- mount
Version
| library | version |
|---|---|
| enzyme | 3.8.0 |
| react | 16.8.2 |
| react-dom | 16.8.2 |
| react-test-renderer | |
| adapter (below) | 1.9.1 |
Adapter
- enzyme-adapter-react-16
mount(<div
ref={(el) => {
console.log(el);
el.removeEventListener('click'); // exception, not a function
}}
>
</div>);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels