|
1 | 1 | import * as React from 'react'; |
2 | 2 |
|
3 | 3 | import IconPuzzlePiece from '../IconPuzzlePiece'; |
4 | | -import { silverChalice } from '../../../styles/variables'; |
5 | 4 |
|
6 | 5 | describe('icons/general/IconPuzzlePiece', () => { |
7 | 6 | test('should correctly render default icon with default color', () => { |
8 | | - const dimension = 14; |
9 | 7 | const wrapper = shallow(<IconPuzzlePiece />); |
10 | | - |
11 | | - expect(wrapper.hasClass('bdl-IconPuzzlePiece')).toEqual(true); |
12 | | - expect(wrapper.find('path').prop('fill')).toEqual(silverChalice); |
13 | | - expect(wrapper.find('AccessibleSVG').prop('width')).toEqual(dimension); |
14 | | - expect(wrapper.find('AccessibleSVG').prop('height')).toEqual(dimension); |
15 | | - expect(wrapper.find('AccessibleSVG').prop('viewBox')).toEqual(`0 0 ${dimension} ${dimension}`); |
| 8 | + expect(wrapper).toMatchSnapshot(); |
16 | 9 | }); |
17 | 10 |
|
18 | 11 | test('should correctly render icon with specified color', () => { |
19 | | - const color = '#fcfcfc'; |
20 | | - const wrapper = shallow(<IconPuzzlePiece color={color} />); |
21 | | - |
22 | | - expect(wrapper.find('path').prop('fill')).toEqual(color); |
| 12 | + const wrapper = shallow(<IconPuzzlePiece color="#fcfcfc" />); |
| 13 | + expect(wrapper).toMatchSnapshot(); |
23 | 14 | }); |
24 | 15 |
|
25 | | - test('should correctly render icon with specified width, height, and viewBox value', () => { |
26 | | - const dimension = 16; |
27 | | - const wrapper = shallow(<IconPuzzlePiece dimension={dimension} />); |
28 | | - |
29 | | - expect(wrapper.find('AccessibleSVG').prop('width')).toEqual(dimension); |
30 | | - expect(wrapper.find('AccessibleSVG').prop('height')).toEqual(dimension); |
31 | | - expect(wrapper.find('AccessibleSVG').prop('viewBox')).toEqual(`0 0 ${dimension} ${dimension}`); |
| 16 | + test('should correctly render icon with specified width and height and default viewBox value', () => { |
| 17 | + const wrapper = shallow(<IconPuzzlePiece height={16} width={16} />); |
| 18 | + expect(wrapper).toMatchSnapshot(); |
32 | 19 | }); |
33 | 20 |
|
34 | 21 | test('should correctly render icon with title', () => { |
35 | | - const title = 'abcde'; |
36 | | - const wrapper = shallow(<IconPuzzlePiece title={title} />); |
| 22 | + const wrapper = shallow(<IconPuzzlePiece title="abcde" />); |
| 23 | + expect(wrapper).toMatchSnapshot(); |
| 24 | + }); |
37 | 25 |
|
38 | | - expect(wrapper.find('AccessibleSVG').prop('title')).toEqual(title); |
| 26 | + test('should correctly render icon with custom class name', () => { |
| 27 | + const wrapper = shallow(<IconPuzzlePiece className="rectangular" />); |
| 28 | + expect(wrapper).toMatchSnapshot(); |
39 | 29 | }); |
40 | 30 | }); |
0 commit comments