diff --git a/src/test/ReactTestUtils.js b/src/test/ReactTestUtils.js index 076180ad41..7421f3be9a 100644 --- a/src/test/ReactTestUtils.js +++ b/src/test/ReactTestUtils.js @@ -66,7 +66,7 @@ var ReactTestUtils = { isDOMComponent: function(inst) { // TODO: Fix this heuristic. It's just here because composites can currently // pretend to be DOM components. - return !!(inst && inst.getDOMNode && inst.tagName); + return !!(inst && inst.tagName && inst.getDOMNode); }, isDOMComponentElement: function(inst) { diff --git a/src/test/__tests__/ReactTestUtils-test.js b/src/test/__tests__/ReactTestUtils-test.js index 9b97f38809..53db1c856b 100644 --- a/src/test/__tests__/ReactTestUtils-test.js +++ b/src/test/__tests__/ReactTestUtils-test.js @@ -179,4 +179,31 @@ describe('ReactTestUtils', function() { // Should be document order, not mount order (which would be purple, orange) expect(log).toEqual(['orangepurple', 'orange', 'purple']); }); + + it('does not warn for getDOMNode on ES6 classes', function() { + var Foo = React.createClass({ + render: function() { + return
; + } + }); + + class Bar extends React.Component { + render() { + return ; + } + } + + spyOn(console, 'warn'); + + var foo = ReactTestUtils.renderIntoDocument(