Guest User

Untitled

a guest
Dec 11th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. // lib/blocks/Button/__tests__/index.js
  2.  
  3. import React from 'react';
  4. import Button from '../index';
  5. import renderer from 'react-test-renderer';
  6. import 'jest-styled-components';
  7.  
  8. describe('Button Block', () => {
  9. it('renders correctly', () => {
  10. const tree = renderer.create(
  11. <Button>
  12. <Button.Text>Login</Button.Text>
  13. <Button.Icon name="home" />
  14. </Button>
  15. ).toJSON();
  16. expect(tree).toMatchSnapshot();
  17. });
  18.  
  19. it('adds the primary modifier', () => {
  20. const tree = renderer.create(
  21. <Button modifiers={['primary']}>
  22. <Button.Text>Login</Button.Text>
  23. <Button.Icon name="home" />
  24. </Button>
  25. ).toJSON();
  26. expect(tree).toMatchSnapshot();
  27. });
  28.  
  29. it('adds the secondary modifier', () => {
  30. const tree = renderer.create(
  31. <Button modifiers={['secondary']}>
  32. <Button.Text>Login</Button.Text>
  33. <Button.Icon name="home" />
  34. </Button>
  35. ).toJSON();
  36. expect(tree).toMatchSnapshot();
  37. });
  38.  
  39. it('adds the disabled modifier', () => {
  40. const tree = renderer.create(
  41. <Button modifiers={['disabled']}>
  42. <Button.Text>Login</Button.Text>
  43. <Button.Icon name="home" />
  44. </Button>
  45. ).toJSON();
  46. expect(tree).toMatchSnapshot();
  47. });
  48. });
Add Comment
Please, Sign In to add comment