Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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();
},
"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>
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', () => {
let tree, link
beforeEach(() => {
renderer.render(<blockquote>)
tree = renderer.getRenderOutput()
link = tree.props.children[1].props.children[1]
})
it('should render', () => {
expect(tree.type).toEqual(Base)
})
it('should set tagName p', () => {
expect(tree.props.tagName).toEqual('blockquote')</blockquote>
it("renders", () => {
const shallowRenderer = TestUtils.createRenderer();
shallowRenderer.render();
const weekdayPicker = shallowRenderer.getRenderOutput();
expect(weekdayPicker.props.className).to.contain("WeekdayPicker");
});
function setup(propOverrides) {
const props = {
};
const renderer = TestUtils.createRenderer();
renderer.render();
const output = renderer.getRenderOutput();
return { props, output };
}
constructor() {
this.renderer = ReactTestUtils.createRenderer();
}
function getRenderOutput(props) {
const renderer = TestUtils.createRenderer();
renderer.render();
return renderer.getRenderOutput();
}
const shallowRender = (component) => {
const renderer = TestUtils.createRenderer();
renderer.render(component);
return renderer.getRenderOutput();
};
function shallowRender(component) {
const renderer = TestUtils.createRenderer();
renderer.render(component);
return renderer.getRenderOutput();
}
function setup() {
let props = {
};
let renderer = TestUtils.createRenderer();
renderer.render();
let output = renderer.getRenderOutput();
return {
props,
output,
renderer
};
}