diff --git a/src/MountedTraversal.js b/src/MountedTraversal.js index 7bc7fb3e6..914dbf909 100644 --- a/src/MountedTraversal.js +++ b/src/MountedTraversal.js @@ -124,6 +124,9 @@ export function childrenOfInstInternal(inst) { if (REACT013 && !node.getPublicInstance) { return false; } + if (typeof node._stringText !== 'undefined') { + return false; + } return true; }).map((node) => { if (!REACT013 && typeof node._currentElement.type === 'function') { diff --git a/test/ReactWrapper-spec.jsx b/test/ReactWrapper-spec.jsx index 6723551cd..77d468686 100644 --- a/test/ReactWrapper-spec.jsx +++ b/test/ReactWrapper-spec.jsx @@ -1910,6 +1910,12 @@ describeWithDOM('mount', () => { expect(children.at(1).hasClass('baz')).to.equal(true); }); + it('should not attempt to get an instance for text nodes', () => { + const wrapper = mount(