enzyme: .instance() doesn't return dom node(null instead)
When I try to find .value
of an input
DOM node .instance()
returns null
.
In enzyme@2* it was very ok with .get(0)
.
What was in enzyme 2* and worked:
const wrapper = mount(<MyComp>); // input somewhere within tree
const inputNode = wrapper.find('input').get(0);
expect(inputNode.value).toBe('0');
In enzyme 3 this doesn’t work. I’ve tried to do this (which should work by documentation):
const wrapper = mount(<MyComp>);
const inputNode = wrapper.find('input').instance(); // <------ returns NULL
expect(inputNode.value).toBe('0');
Is this a bug or I missed something?
P.S. React is 15.1.0 with enzyme-adapter-react-15.4
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 4
- Comments: 15 (7 by maintainers)
Here it fails
Here it works
Ok, I’ll try and report