@@ -7,93 +7,93 @@ import Tag from '../src/component/js/Tag';
77const TAG_NAME = 'foo' ;
88
99describe ( 'Tag' , ( ) => {
10- it ( 'should render' , ( ) => {
11- const component = renderer . create (
12- < Tag
13- name = { TAG_NAME } />
14- ) . toJSON ( ) ;
15-
16- expect ( component ) . toMatchSnapshot ( ) ;
17- } ) ;
10+ it ( 'should render' , ( ) => {
11+ const component = renderer . create (
12+ < Tag
13+ name = { TAG_NAME } />
14+ ) . toJSON ( ) ;
15+
16+ expect ( component ) . toMatchSnapshot ( ) ;
17+ } ) ;
1818} ) ;
1919
2020describe ( 'Tag - "readOnly"' , ( ) => {
21- describe ( 'when false' , ( ) => {
22- it ( 'should render the removeTagIcon' , ( ) => {
23- const component = shallow (
24- < Tag
25- name = { TAG_NAME }
26- readOnly = { false } />
27- ) ;
28-
29- expect ( component . find ( 'a' ) ) . toHaveLength ( 1 ) ;
30- expect ( component . find ( 'a' ) . text ( ) ) . toEqual ( String . fromCharCode ( 215 ) ) ;
31-
32- expect ( toJson ( component ) ) . toMatchSnapshot ( ) ;
33- } ) ;
34- } ) ;
35-
36- describe ( 'when true' , ( ) => {
37- it ( 'should not render the removeTagIcon' , ( ) => {
38- const component = shallow (
39- < Tag
40- name = { TAG_NAME }
41- readOnly = { true } />
42- ) ;
43-
44- expect ( component . find ( 'a' ) ) . toHaveLength ( 0 ) ;
45-
46- expect ( toJson ( component ) ) . toMatchSnapshot ( ) ;
47- } ) ;
48- } ) ;
21+ describe ( 'when false' , ( ) => {
22+ it ( 'should render the removeTagIcon' , ( ) => {
23+ const component = shallow (
24+ < Tag
25+ name = { TAG_NAME }
26+ readOnly = { false } />
27+ ) ;
28+
29+ expect ( component . find ( 'a' ) ) . toHaveLength ( 1 ) ;
30+ expect ( component . find ( 'a' ) . text ( ) ) . toEqual ( String . fromCharCode ( 215 ) ) ;
31+
32+ expect ( toJson ( component ) ) . toMatchSnapshot ( ) ;
33+ } ) ;
34+ } ) ;
35+
36+ describe ( 'when true' , ( ) => {
37+ it ( 'should not render the removeTagIcon' , ( ) => {
38+ const component = shallow (
39+ < Tag
40+ name = { TAG_NAME }
41+ readOnly = { true } />
42+ ) ;
43+
44+ expect ( component . find ( 'a' ) ) . toHaveLength ( 0 ) ;
45+
46+ expect ( toJson ( component ) ) . toMatchSnapshot ( ) ;
47+ } ) ;
48+ } ) ;
4949} ) ;
5050
5151describe ( 'Tag - "removeTagIcon"' , ( ) => {
52- describe ( 'when a custom element is passed in' , ( ) => {
53- it ( 'should render the element' , ( ) => {
54- const customRemoveIcon = (
55- < i className = "icon-remove" > </ i >
56- ) ;
57-
58- const component = renderer . create (
59- < Tag
60- name = { TAG_NAME }
61- removeTagIcon = { customRemoveIcon } />
62- ) . toJSON ( ) ;
63-
64- expect ( component ) . toMatchSnapshot ( ) ;
65- } ) ;
66- } ) ;
67-
68- describe ( 'when a custom string is passed in' , ( ) => {
69- it ( 'should render the string' , ( ) => {
70- const customRemoveString = 'remove' ;
71-
72- const component = renderer . create (
73- < Tag
74- name = { TAG_NAME }
75- removeTagIcon = { customRemoveString } />
76- ) . toJSON ( ) ;
77-
78- expect ( component ) . toMatchSnapshot ( ) ;
79- } ) ;
80- } ) ;
52+ describe ( 'when a custom element is passed in' , ( ) => {
53+ it ( 'should render the element' , ( ) => {
54+ const customRemoveIcon = (
55+ < i className = "icon-remove" > </ i >
56+ ) ;
57+
58+ const component = renderer . create (
59+ < Tag
60+ name = { TAG_NAME }
61+ removeTagIcon = { customRemoveIcon } />
62+ ) . toJSON ( ) ;
63+
64+ expect ( component ) . toMatchSnapshot ( ) ;
65+ } ) ;
66+ } ) ;
67+
68+ describe ( 'when a custom string is passed in' , ( ) => {
69+ it ( 'should render the string' , ( ) => {
70+ const customRemoveString = 'remove' ;
71+
72+ const component = renderer . create (
73+ < Tag
74+ name = { TAG_NAME }
75+ removeTagIcon = { customRemoveString } />
76+ ) . toJSON ( ) ;
77+
78+ expect ( component ) . toMatchSnapshot ( ) ;
79+ } ) ;
80+ } ) ;
8181} ) ;
8282
8383describe ( 'Tag - "onRemoveTag"' , ( ) => {
84- it ( 'should be called when clicking the remove icon' , ( ) => {
85- const onRemoveClick = jest . fn ( ) ;
84+ it ( 'should be called when clicking the remove icon' , ( ) => {
85+ const onRemoveClick = jest . fn ( ) ;
8686
87- const component = shallow (
88- < Tag
89- name = { TAG_NAME }
90- onRemoveTag = { onRemoveClick } />
91- ) ;
87+ const component = shallow (
88+ < Tag
89+ name = { TAG_NAME }
90+ onRemoveTag = { onRemoveClick } />
91+ ) ;
9292
93- component . find ( 'a' ) . simulate ( 'click' , {
94- preventDefault ( ) { }
95- } ) ;
93+ component . find ( 'a' ) . simulate ( 'click' , {
94+ preventDefault ( ) { }
95+ } ) ;
9696
97- expect ( onRemoveClick ) . toBeCalled ( ) ;
98- } ) ;
97+ expect ( onRemoveClick ) . toBeCalled ( ) ;
98+ } ) ;
9999} ) ;
0 commit comments