@@ -7,90 +7,82 @@ import { Avatar } from '..'
77import support from '../__stories__/assets/avatar.svg'
88
99describe ( 'avatar' , ( ) => {
10- describe . each ( [ 'circle' , 'square' ] as const ) (
11- `renders correctly with shape %s` ,
12- shape => {
13- describe . each ( [ 'xsmall' , 'small' , 'medium' , 'large' ] as const ) (
14- `renders correctly with shape ${ shape } and size %s` ,
15- size => {
16- it ( 'renders correctly with variant user' , ( ) =>
17- shouldMatchSnapshot (
18- < Avatar shape = { shape } size = { size } variant = "user" /> ,
19- ) )
10+ describe . each ( [
11+ 'circle' ,
12+ 'square' ,
13+ ] as const ) ( `renders correctly with shape %s` , shape => {
14+ describe . each ( [
15+ 'xsmall' ,
16+ 'small' ,
17+ 'medium' ,
18+ 'large' ,
19+ ] as const ) ( `renders correctly with shape ${ shape } and size %s` , size => {
20+ it ( 'renders correctly with variant user' , ( ) =>
21+ shouldMatchSnapshot (
22+ < Avatar shape = { shape } size = { size } variant = "user" /> ,
23+ ) )
2024
21- it ( 'renders correctly with variant image' , ( ) =>
22- shouldMatchSnapshot (
23- < Avatar
24- image = { support }
25- shape = { shape }
26- size = { size }
27- variant = "image"
28- /> ,
29- ) )
25+ it ( 'renders correctly with variant image' , ( ) =>
26+ shouldMatchSnapshot (
27+ < Avatar image = { support } shape = { shape } size = { size } variant = "image" /> ,
28+ ) )
3029
31- it ( 'renders correctly with variant text' , ( ) =>
32- shouldMatchSnapshot (
33- < Avatar shape = { shape } size = { size } text = "UV" variant = "text" /> ,
34- ) )
30+ it ( 'renders correctly with variant text' , ( ) =>
31+ shouldMatchSnapshot (
32+ < Avatar shape = { shape } size = { size } text = "UV" variant = "text" /> ,
33+ ) )
3534
36- it ( 'renders correctly with variant text and sentiment neutral' , ( ) =>
37- shouldMatchSnapshot (
38- < Avatar
39- sentiment = "neutral"
40- shape = { shape }
41- size = { size }
42- text = "UV"
43- variant = "text"
44- /> ,
45- ) )
35+ it ( 'renders correctly with variant text and sentiment neutral' , ( ) =>
36+ shouldMatchSnapshot (
37+ < Avatar
38+ sentiment = "neutral"
39+ shape = { shape }
40+ size = { size }
41+ text = "UV"
42+ variant = "text"
43+ /> ,
44+ ) )
4645
47- it ( 'renders correctly with variant icon' , ( ) =>
48- shouldMatchSnapshot (
49- < Avatar shape = { shape } size = { size } variant = "icon" >
50- < MosaicIcon />
51- </ Avatar > ,
52- ) )
46+ it ( 'renders correctly with variant icon' , ( ) =>
47+ shouldMatchSnapshot (
48+ < Avatar shape = { shape } size = { size } variant = "icon" >
49+ < MosaicIcon />
50+ </ Avatar > ,
51+ ) )
5352
54- it ( 'renders correctly with variant icon and sentiment neutral' , ( ) =>
55- shouldMatchSnapshot (
56- < Avatar
57- sentiment = "neutral"
58- shape = { shape }
59- size = { size }
60- variant = "icon"
61- >
62- < MosaicIcon />
63- </ Avatar > ,
64- ) )
53+ it ( 'renders correctly with variant icon and sentiment neutral' , ( ) =>
54+ shouldMatchSnapshot (
55+ < Avatar sentiment = "neutral" shape = { shape } size = { size } variant = "icon" >
56+ < MosaicIcon />
57+ </ Avatar > ,
58+ ) )
6559
66- it ( 'renders correctly with variant colors' , ( ) =>
67- shouldMatchSnapshot (
68- < Avatar shape = { shape } size = { size } variant = "colors" /> ,
69- ) )
60+ it ( 'renders correctly with variant colors' , ( ) =>
61+ shouldMatchSnapshot (
62+ < Avatar shape = { shape } size = { size } variant = "colors" /> ,
63+ ) )
7064
71- it ( 'renders correctly with variant text and upload' , async ( ) => {
72- const onClick = vi . fn ( )
73- const { asFragment } = renderWithTheme (
74- < Avatar
75- data-testid = "avatar"
76- onClick = { onClick }
77- shape = { shape }
78- size = { size }
79- text = "UV"
80- upload
81- variant = "text"
82- /> ,
83- )
84- const avatar = screen . getByTestId ( 'avatar' )
65+ it ( 'renders correctly with variant text and upload' , async ( ) => {
66+ const onClick = vi . fn ( )
67+ const { asFragment } = renderWithTheme (
68+ < Avatar
69+ data-testid = "avatar"
70+ onClick = { onClick }
71+ shape = { shape }
72+ size = { size }
73+ text = "UV"
74+ upload
75+ variant = "text"
76+ /> ,
77+ )
78+ const avatar = screen . getByTestId ( 'avatar' )
8579
86- await userEvent . hover ( avatar )
87- expect ( asFragment ( ) ) . toMatchSnapshot ( )
80+ await userEvent . hover ( avatar )
81+ expect ( asFragment ( ) ) . toMatchSnapshot ( )
8882
89- await userEvent . click ( avatar )
90- expect ( onClick ) . toHaveBeenCalledOnce ( )
91- } )
92- } ,
93- )
94- } ,
95- )
83+ await userEvent . click ( avatar )
84+ expect ( onClick ) . toHaveBeenCalledOnce ( )
85+ } )
86+ } )
87+ } )
9688} )
0 commit comments