import PropTypes from '../../lib/ReactPropTypes'; import ReactTestUtils from "../../lib/ReactTestUtils"; import React from '../../src/May'; import { render, unmountComponentAtNode, findDOMNode } from '../../src/may-dom/MayDom' var ReactDOM = { render: render, unmountComponentAtNode: unmountComponentAtNode, findDOMNode: findDOMNode } React.render = render; describe("ReactCompositeComponentDOMMinimalism",function() { // this.timeout(200000); var LowerLevelComposite = class extends React.Component { render() { return
{this.props.children}
; } }; var MyCompositeComponent = class extends React.Component { render() { return {this.props.children}; } }; var expectSingleChildlessDiv = function(instance) { var el = ReactDOM.findDOMNode(instance); expect(el.tagName).toBe("DIV"); expect(el.children.length).toBe(0); }; it("should not render extra nodes for non-interpolated text", () => { var instance = A string child; instance = ReactTestUtils.renderIntoDocument(instance); expectSingleChildlessDiv(instance); }); it("should not render extra nodes for non-interpolated text", () => { var instance = {"Interpolated String Child"}; instance = ReactTestUtils.renderIntoDocument(instance); expectSingleChildlessDiv(instance); }); it("should not render extra nodes for non-interpolated text", () => { var instance = ( ); instance = ReactTestUtils.renderIntoDocument(instance); var el = ReactDOM.findDOMNode(instance); expect(el.tagName).toBe("DIV"); expect(el.children.length).toBe(1); expect(el.children[0].tagName).toBe("UL"); expect(el.children[0].children.length).toBe(0); }); });