β Button/
βββ __tests__/
| | βββ __snapshots__
| | | βββ index.js.snap // <- Button snapshot
| βββ index.js // <- Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from 'react'; | |
| import Button from '../index'; | |
| import renderer from 'react-test-renderer'; | |
| describe('Button Block', () => { | |
| it('renders correctly', () => { | |
| const tree = renderer | |
| .create(<Button>Submit</Button>) | |
| .toJSON(); | |
| expect(tree).toMatchSnapshot(); |
β lib/
βββ blocks/
| βββ Button/
| | βββ __tests__/
| | | βββ Icon.js // <- Element Test
| | | βββ index.js // <- Block Test
| | βββ Icon.js // <- Element
| | βββ Text.js // <- Element
| | βββ index.js // <- Block
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // lib/blocks/Button/__tests__/index.js | |
| import React from 'react'; | |
| import Button from '../index'; | |
| import renderer from 'react-test-renderer'; | |
| describe('Button Block', () => { | |
| it('renders correctly', () => { | |
| const tree = renderer.create( | |
| <Button> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ yarn test | |
| PASS lib/blocks/Button/__tests__/index.js | |
| Button Block | |
| β renders correctly (15ms) | |
| βΊ 1 snapshot written. | |
| Snapshot Summary | |
| βΊ 1 snapshot written in 1 test suite. |
β lib/
βββ blocks/
| βββ Button/
| | βββ __tests__/
| | | βββ __snapshots__/
| | | | βββ index.js.snap // <- Button snapshot
| | | βββ Icon.js // <- Element Test
| | | βββ index.js // <- Block Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| β¦ | |
| const Button = styled.button` | |
| background-color: #7D7D7D; | |
| border-radius: 2px; | |
| border: solid 1px transparent; | |
| color: #FFF; | |
| cursor: pointer; | |
| β¦ | |
| `; |