Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // lib/blocks/Button/__tests__/index.js
- import React from 'react';
- import Button from '../index';
- import renderer from 'react-test-renderer';
- import 'jest-styled-components';
- describe('Button Block', () => {
- it('renders correctly', () => {
- const tree = renderer.create(
- <Button>
- <Button.Text>Login</Button.Text>
- <Button.Icon name="home" />
- </Button>
- ).toJSON();
- expect(tree).toMatchSnapshot();
- });
- it('adds the primary modifier', () => {
- const tree = renderer.create(
- <Button modifiers={['primary']}>
- <Button.Text>Login</Button.Text>
- <Button.Icon name="home" />
- </Button>
- ).toJSON();
- expect(tree).toMatchSnapshot();
- });
- it('adds the secondary modifier', () => {
- const tree = renderer.create(
- <Button modifiers={['secondary']}>
- <Button.Text>Login</Button.Text>
- <Button.Icon name="home" />
- </Button>
- ).toJSON();
- expect(tree).toMatchSnapshot();
- });
- it('adds the disabled modifier', () => {
- const tree = renderer.create(
- <Button modifiers={['disabled']}>
- <Button.Text>Login</Button.Text>
- <Button.Icon name="home" />
- </Button>
- ).toJSON();
- expect(tree).toMatchSnapshot();
- });
- });
Add Comment
Please, Sign In to add comment