diff --git a/src/Utils.js b/src/Utils.js index dc1401d85..f89897240 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -64,6 +64,7 @@ export function nodeEqual(a, b) { if (a === b) return true; if (!a || !b) return false; if (a.type !== b.type) return false; + const left = propsOfNode(a); const leftKeys = Object.keys(left); const right = propsOfNode(b); @@ -80,7 +81,12 @@ export function nodeEqual(a, b) { return false; } } - return leftKeys.length === Object.keys(right).length; + + if (typeof a !== 'string' && typeof a !== 'number') { + return leftKeys.length === Object.keys(right).length; + } + + return false; } // 'click' => 'onClick' diff --git a/src/__tests__/ShallowWrapper-spec.js b/src/__tests__/ShallowWrapper-spec.js index 5a4698c3a..718df00c0 100644 --- a/src/__tests__/ShallowWrapper-spec.js +++ b/src/__tests__/ShallowWrapper-spec.js @@ -83,6 +83,38 @@ describe('shallow', () => { expect(wrapper.contains(b)).to.equal(true); }); + it('should work with strings', () => { + const wrapper = shallow(