How to use the react-addons-test-utils.createRenderer 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 airbnb / enzyme / packages / enzyme-adapter-react-14 / src / ReactFourteenAdapter.js View on Github external
createShallowRenderer(/* options */) {
    const renderer = TestUtils.createRenderer();
    let isDOM = false;
    let cachedNode = null;
    return {
      render(el, context) {
        cachedNode = el;
        /* eslint consistent-return: 0 */
        if (typeof el.type === 'string') {
          isDOM = true;
        } else {
          isDOM = false;
          return withSetStateAllowed(() => renderer.render(el, context));
        }
      },
      unmount() {
        renderer.unmount();
      },
github Donmclean / riko / bin / _setup / _demo-src / __tests__ / jest-example-menu.spec.js View on Github external
"use strict";

import React from 'react';
import ReactTestUtils from 'react-addons-test-utils';

const renderer = ReactTestUtils.createRenderer();

import Menu from '../js/components/Menu.jsx';

describe('Menu', function () {

    renderer.render(<menu>);
    let result;

    beforeEach(function() {
        renderer.render(<menu>);
        result = renderer.getRenderOutput();
    });

    it('renders without problems', function () {
        expect(result).toBeTruthy();
    });</menu></menu>
github rebassjs / rebass / test / Blockquote.spec.js View on Github external
import React from 'react'
import TestUtils from 'react-addons-test-utils'
import expect from 'expect'
import { Blockquote, Base } from '../src'

const renderer = TestUtils.createRenderer()

describe('Blockquote', () =&gt; {
  let tree, link

  beforeEach(() =&gt; {
    renderer.render(<blockquote>)
    tree = renderer.getRenderOutput()
    link = tree.props.children[1].props.children[1]
  })

  it('should render', () =&gt; {
    expect(tree.type).toEqual(Base)
  })

  it('should set tagName p', () =&gt; {
    expect(tree.props.tagName).toEqual('blockquote')</blockquote>
github ntdb / react-weekday-picker / test / WeekdayPicker.js View on Github external
it("renders", () =&gt; {
    const shallowRenderer = TestUtils.createRenderer();
    shallowRenderer.render();

    const weekdayPicker = shallowRenderer.getRenderOutput();
    expect(weekdayPicker.props.className).to.contain("WeekdayPicker");
  });
github jhen0409 / react-chrome-extension-boilerplate / test / app / injectapp / components / RepoButton.spec.js View on Github external
function setup(propOverrides) {
  const props = {
  };

  const renderer = TestUtils.createRenderer();
  renderer.render();
  const output = renderer.getRenderOutput();

  return { props, output };
}
github sheepsteak / react-shallow-testutils / src / renderer.js View on Github external
constructor() {
    this.renderer = ReactTestUtils.createRenderer();
  }
github ivantsov / yandex-mail-notifier-firefox / src / panel / __tests__ / components / hover-menu.js View on Github external
function getRenderOutput(props) {
    const renderer = TestUtils.createRenderer();

    renderer.render();

    return renderer.getRenderOutput();
}
github opencredo / opencredo-react-boilerplate / src / components / FormFields / HorizontalRadioGroup.spec.js View on Github external
const shallowRender = (component) => {
  const renderer = TestUtils.createRenderer();

  renderer.render(component);

  return renderer.getRenderOutput();
};
github opencredo / opencredo-react-boilerplate / src / components / DropdownProfileCard / DropdownProfileCard.spec.js View on Github external
function shallowRender(component) {
  const renderer = TestUtils.createRenderer();

  renderer.render(component);
  return renderer.getRenderOutput();
}
github atSistemas / react-base / src / containers / Home / spec / Home.spec.js View on Github external
function setup() {
  let props = {
    
  };

  let renderer = TestUtils.createRenderer();
  renderer.render();
  let output = renderer.getRenderOutput();

  return {
    props,
    output,
    renderer
  };
}