@samitouri / QOS-React-2 / commits / 69e6ab5083

Add test for DOM node as this.props.children

Ben Alpert committed May 14, 2015 at 16:43 UTC 69e6ab5083fbecf5d543ec798a0327b67e3b616d
1 file changed +17
src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js
+17
@@ -475,4 +475,21 @@ describe('ReactElementValidator', function() {
475 expect(console.error.argsForCall.length).toBe(1);
476 });
477
478 + it('does not warn when using DOM node as children', function() {
479 + spyOn(console, 'error');
480 + var DOMContainer = React.createClass({
481 + render: function() {
482 + return <div />;
483 + },
484 + componentDidMount: function() {
485 + React.findDOMNode(this).appendChild(this.props.children);
486 + }
487 + });
488 +
489 + var node = document.createElement('div');
490 + // This shouldn't cause a stack overflow or any other problems (#3883)
491 + ReactTestUtils.renderIntoDocument(<DOMContainer>{node}</DOMContainer>);
492 + expect(console.error.argsForCall.length).toBe(0);
493 + });
494 +
495 });