Skip to content

Instantly share code, notes, and snippets.

@trotzig
Created November 24, 2014 12:13
Show Gist options
  • Save trotzig/a1124de81ebe183f6a9f to your computer and use it in GitHub Desktop.
Save trotzig/a1124de81ebe183f6a9f to your computer and use it in GitHub Desktop.
describe('Button', () => {
subject(() => {
return React.addons.TestUtils.renderIntoDocument(
<Button {...this.lets['props']} />
);
});
describe('with a `text` prop', => {
let('props', { text: 'Click me'});
it('renders the text', () => {
expect(this.subject()).toHaveText('Click me');
});
describe('and an `icon` prop', () => {
let('props', { icon: 'email'});
it('renders the icon', () => {
expect(this.subject()).toHaveIcon('email');
});
it('renders the text', () => {
expect(this.subject()).toHaveText('Click me');
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment