1
1
import { CStack , CBox , CHeading , CText } from '../..'
2
- import { render , getTagName } from '@/tests/test-utils'
2
+ import { render , getTagName , screen } from '@/tests/test-utils'
3
3
4
4
const renderComponent = ( props ) => {
5
5
const inlineAttrs = ( props && props . inlineAttrs ) || ''
@@ -27,22 +27,22 @@ it('should render correctly', () => {
27
27
} )
28
28
29
29
it ( 'should default to vertical stack' , ( ) => {
30
- const { getByTestId } = renderComponent ( )
31
- const stack = getByTestId ( 'stack' )
30
+ renderComponent ( )
31
+ const stack = screen . getByTestId ( 'stack' )
32
32
expect ( stack ) . toHaveStyle ( 'display: flex' )
33
33
expect ( stack ) . toHaveStyle ( 'flex-direction: column' )
34
34
} )
35
35
36
36
it ( 'should not space last child' , ( ) => {
37
- const { getByTestId } = renderComponent ( )
38
- const stack = getByTestId ( 'stack' )
37
+ renderComponent ( )
38
+ const stack = screen . getByTestId ( 'stack' )
39
39
expect ( stack ) . not . toHaveStyle ( 'margin-bottom: 0.5rem' )
40
40
} )
41
41
42
42
it ( 'should should stack horizontally if isInline' , ( ) => {
43
43
const inlineAttrs = 'is-inline'
44
- const { getByTestId } = renderComponent ( { inlineAttrs } )
45
- const stack = getByTestId ( 'stack' )
44
+ renderComponent ( { inlineAttrs } )
45
+ const stack = screen . getByTestId ( 'stack' )
46
46
expect ( stack ) . toHaveStyle ( 'display: flex' )
47
47
expect ( stack ) . toHaveStyle ( 'flex-direction: row' )
48
48
} )
@@ -58,8 +58,8 @@ it.each`
58
58
'should render CStack with element as $as' ,
59
59
( { as } ) => {
60
60
const inlineAttrs = `as="${ as } "`
61
- const { asFragment, getByTestId } = renderComponent ( { inlineAttrs } )
62
- const stack = getByTestId ( 'stack' )
61
+ const { asFragment } = renderComponent ( { inlineAttrs } )
62
+ const stack = screen . getByTestId ( 'stack' )
63
63
expect ( getTagName ( stack ) ) . toEqual ( as )
64
64
expect ( asFragment ( ) ) . toMatchSnapshot ( )
65
65
}
0 commit comments