Is there a way to get the actual DOM node so I can the query it with the Dom api as opposed to being required to use enzyme\'s api, it\'s just for edge cases where for examp
Perhaps you are looking for enzyme's instance()?
const wrapper = mount()
console.log(wrapper.instance().value); // 'hello'
PS:
instance() should give you a ReactComponent, from which you can use ReactDOM.findDOMNode(ReactComponent) to get a DOMNode. However, when I did that, like the following, it was the exact same object as wrapper.instance():
import ReactDOM from 'react-dom'
const wrapper = mount()
console.log(ReactDOM.findDOMNode(wrapper.instance()) == wrapper.instance()) // true
I don't understand why that is. If you console.log() either one of those, you'll see a HTMLInputElement, but it will contain lots of non-native DOM node looking stuff:
HTMLInputElement {
'__reactInternalInstance$yt1y6akr6yldi':
ReactDOMComponent {
_currentElement:
{ '$$typeof': Symbol(react.element),
type: 'input',
key: null,
ref: null,
props: [Object],
_owner: [Object],
_store: {} },