PluginProbe ʕ •ᴥ•ʔ
GenerateBlocks / 2.2.0
GenerateBlocks v2.2.0
trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.1.2 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.8.3 1.9.0 1.9.1 2.0.0 2.0.1 2.0.2 2.1.0 2.1.1 2.1.2 2.2.0 2.2.1 2.3.0
generateblocks / src / components / icon-wrapper / test / index.js
generateblocks / src / components / icon-wrapper / test Last commit date
__snapshots__ 2 years ago index.js 2 years ago
index.js
82 lines
1 import { render } from '@testing-library/react';
2 import IconWrapper from '../index';
3 import generalSvgs from '../../icon-picker/svgs-general';
4
5 const ChildrenComponent = () => ( <h2> { 'My children component' } </h2> );
6
7 describe( 'IconWrapper', () => {
8 it( 'should render children elements', () => {
9 const wrapper = render(
10 <IconWrapper>
11 <ChildrenComponent />
12 </IconWrapper>
13 );
14
15 expect( wrapper ).toMatchSnapshot();
16 } );
17
18 it( 'should render left icon', () => {
19 const wrapper = render(
20 <IconWrapper icon={ generalSvgs.clock.icon }>
21 <ChildrenComponent />
22 </IconWrapper>
23 );
24
25 expect( wrapper ).toMatchSnapshot();
26 } );
27
28 it( 'should render right icon', () => {
29 const wrapper = render(
30 <IconWrapper icon={ generalSvgs.clock.icon } direction={ 'right' }>
31 <ChildrenComponent />
32 </IconWrapper>
33 );
34
35 expect( wrapper ).toMatchSnapshot();
36 } );
37
38 it( 'should hide children elements', () => {
39 const wrapper = render(
40 <IconWrapper icon={ generalSvgs.clock.icon } hideChildren={ true }>
41 <ChildrenComponent />
42 </IconWrapper>
43 );
44
45 expect( wrapper ).toMatchSnapshot();
46 } );
47
48 it( 'should render multiple children', () => {
49 const wrapper = render(
50 <IconWrapper icon={ generalSvgs.clock.icon }>
51 <ChildrenComponent />
52 <ChildrenComponent />
53 <ChildrenComponent />
54 </IconWrapper>
55 );
56
57 expect( wrapper ).toMatchSnapshot();
58 } );
59
60 it( 'should render without children', () => {
61 const wrapper = render(
62 <IconWrapper icon={ generalSvgs.clock.icon } />
63 );
64
65 expect( wrapper ).toMatchSnapshot();
66 } );
67
68 it( 'should render with wrapper element', () => {
69 const wrapper = render(
70 <IconWrapper
71 icon={ generalSvgs.clock.icon }
72 hideWrapper={ false }
73 wrapperClassname={ 'my-wrapper-class' }
74 >
75 <ChildrenComponent />
76 </IconWrapper>
77 );
78
79 expect( wrapper ).toMatchSnapshot();
80 } );
81 } );
82