1
1
import { CBox , CTag , CTagLabel , CTagIcon , CTagCloseButton , CAvatar } from '../..'
2
- import { render } from '@/tests/test-utils'
2
+ import { render , screen } from '@/tests/test-utils'
3
3
4
4
const renderComponent = ( props ) => {
5
5
const base = {
@@ -22,38 +22,36 @@ it('should render correctly', () => {
22
22
} )
23
23
24
24
it ( 'should display children' , ( ) => {
25
- const { getByText } = renderComponent ( )
25
+ renderComponent ( )
26
26
27
- expect ( getByText ( 'Green' ) ) . toBeInTheDocument ( )
27
+ expect ( screen . getByText ( 'Green' ) ) . toBeInTheDocument ( )
28
28
} )
29
29
30
30
it ( 'should display tag with right icon' , ( ) => {
31
31
const { asFragment } = renderComponent ( {
32
32
template : `
33
- <CBox mb="3">
34
- <CTag size="sm" variantColor="green">
35
- <CTagLabel>Green</CTagLabel>
36
- <CTagIcon icon="add" size="12px" />
37
- </CTag>
38
- </CBox>
39
- `
33
+ <CBox mb="3">
34
+ <CTag size="sm" variantColor="green">
35
+ <CTagLabel>Green</CTagLabel>
36
+ <CTagIcon icon="add" size="12px" />
37
+ </CTag>
38
+ </CBox>`
40
39
} )
41
40
expect ( asFragment ( ) ) . toMatchSnapshot ( )
42
41
} )
43
42
it ( 'should display tag with custom element' , ( ) => {
44
43
const { asFragment } = renderComponent ( {
45
44
template : `
46
- <CBox mb="3">
47
- <CTag rounded="full" variantColor="red">
48
- <CAvatar
49
- name="Mesut Koca"
50
- size="xs"
51
- src="https://pbs.twimg.com/profile_images/953743486842474496/cOrUdK4z_200x200.jpg"
52
- />
53
- <CTagLabel>Mesut</CTagLabel>
54
- </CTag>
55
- </CBox>
56
- `
45
+ <CBox mb="3">
46
+ <CTag rounded="full" variantColor="red">
47
+ <CAvatar
48
+ name="Mesut Koca"
49
+ size="xs"
50
+ src="https://pbs.twimg.com/profile_images/953743486842474496/cOrUdK4z_200x200.jpg"
51
+ />
52
+ <CTagLabel>Mesut</CTagLabel>
53
+ </CTag>
54
+ </CBox>`
57
55
} )
58
56
expect ( asFragment ( ) ) . toMatchSnapshot ( )
59
57
} )
0 commit comments