Accepted answer

from what i understand, testutils.renderintodocument() returns a reactcomponent tree. then you can pull individual components out of that tree to test them.

for example, this test passes for me.

it('demonstrates the reactcomponent tree', function() {
  var react = require('react/addons');
  var testutils = react.addons.testutils;
  var mycomponent = require('../mycomponent.jsx');

  var renderedtree = testutils.renderintodocument(<mycomponent />);
  var renderedmycomponent = testutils.findrendereddomcomponentwithclass(renderedtree, 'my-component')


so if you're just rendering a single component, it will be the root of the renderedtree. but you still have to find the rendered mycomponent inside the renderedtree before you can check assertions against it.

Related Query

More Query from same tag