Skip to content

Instantly share code, notes, and snippets.



Last active Oct 21, 2015
What would you like to do?
Shallow rendering example
import React from 'react';
import Label from './Label';
class Button extends React.Component {
render() {
return <div><Label name={} /></div>;
export default Button;
import React from 'react';
class Label extends React.Component {
render() {
return <span>Hello {}</span>;
export default Label;
import React from 'react';
import expect from 'expect';
import {createRenderer} from 'react-addons-test-utils';
import Button from './Button.js';
import Label from './Label.js';
describe('Button', () => {
it('works', () => {
let renderer = createRenderer();
renderer.render(<Button name="John" />);
let actualElement = renderer.getRenderOutput();
let expectedElement = <div><Label name="John" /></div>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment