How to use the react-addons-test-utils.isDOMComponent function in react-addons-test-utils

To help you get started, we’ve selected a few react-addons-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github AndrewKeig / react-speech / test / button.js View on Github external
it('should render component', () => {
      expect(TestUtils.isDOMComponent(component)).to.equal(true);
    });
github microsoft / fluent-ui-react / test / utils / RenderedTree.js View on Github external
assertText(text) {
    const re = new RegExp(text, 'g')
    const first = this.first()
    const textContent = isDOMComponent(first) ? first.textContent : findDOMNode(first).textContent
    const all = _.words(textContent, re)
    if (all.length !== 1) {
      throw new Error(`Did not find exactly one match (found: ${all.length}) for text: "${text}"`)
    }
    return true
  }
}
github react-melon / melon / test / components / select / SeparatePopup.spec.js View on Github external
node
        );
        let content;

        expect(component.state).toEqual({
            styles: {
                top: 0,
                left: -5000,
                height: 0,
                opacity: 0,
                width: 0
            }
        });

        content = component.main;
        expect(TestUtils.isDOMComponent(content)).toBeTruthy();

        component = ReactDOM.render(
            ,
            node,
            () => {
                expect(component.state.styles.opacity).toBe(1);
                done();
            }
        );

    });
github Quartz / Chartbuilder / test / jsx / chart-grid-xy.jsx View on Github external
var rw = TU.renderIntoDocument(
		
	);

	var svg = TU.findRenderedDOMComponentWithTag(
		rw,
		"svg"
	);

	t.ok(TU.isDOMComponent(svg), "svg rendered to DOM");

	var svg_dom = ReactDOM.findDOMNode(svg);
	var d3svg = d3.select(svg_dom);

	var num_series = randXYGrid.chartProps._grid.cols * randXYGrid.chartProps._grid.rows;
	var num_vals = _.reduce(randXYGrid.chartProps.data, function(numVals, d) {
		return numVals + d.values.length;
	}, 0);

	var grids = d3svg.selectAll("g.grid-chart-block");
	t.equal(num_series, grids[0].length, "number of rendered bar grid blocks correct");

	//TODO: Check that correct types are rendererd

	ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(rw).parentNode);
	t.end();
github romseguy / react2tree / src / index.js View on Github external
function traverse(c, node) {
    if (!c || isDOMComponent(c)) {
      return;
    }

    const newNodeName = typeof c === 'function' ? c.name : c.constructor.name;

    node.children.push({
      name: newNodeName,
      children: []
    });

    const ccc = getRenderedChildOfCompositeComponent(c);

    if (isDOMComponent(ccc)) {
      React.Children.forEach(ccc.props.children, function traverseChildWithNode(child) {
        if (child.type) {
          traverse(child.type, getNode(node, newNodeName));
        }
      });
    } else {
      traverse(ccc, getNode(node, c.constructor.name));
    }
  }
github romseguy / react2tree / src / index.js View on Github external
function traverse(c, node) {
    if (!c || isDOMComponent(c)) {
      return;
    }

    const newNodeName = typeof c === 'function' ? c.name : c.constructor.name;

    node.children.push({
      name: newNodeName,
      children: []
    });

    const ccc = getRenderedChildOfCompositeComponent(c);

    if (isDOMComponent(ccc)) {
      React.Children.forEach(ccc.props.children, function traverseChildWithNode(child) {
        if (child.type) {
          traverse(child.type, getNode(node, newNodeName));