Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit b3f4806

Browse files
committed
test(stack): refactor use screen
1 parent 57dd80e commit b3f4806

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/chakra-ui-core/src/CStack/tests/CStack.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { CStack, CBox, CHeading, CText } from '../..'
2-
import { render, getTagName } from '@/tests/test-utils'
2+
import { render, getTagName, screen } from '@/tests/test-utils'
33

44
const renderComponent = (props) => {
55
const inlineAttrs = (props && props.inlineAttrs) || ''
@@ -27,22 +27,22 @@ it('should render correctly', () => {
2727
})
2828

2929
it('should default to vertical stack', () => {
30-
const { getByTestId } = renderComponent()
31-
const stack = getByTestId('stack')
30+
renderComponent()
31+
const stack = screen.getByTestId('stack')
3232
expect(stack).toHaveStyle('display: flex')
3333
expect(stack).toHaveStyle('flex-direction: column')
3434
})
3535

3636
it('should not space last child', () => {
37-
const { getByTestId } = renderComponent()
38-
const stack = getByTestId('stack')
37+
renderComponent()
38+
const stack = screen.getByTestId('stack')
3939
expect(stack).not.toHaveStyle('margin-bottom: 0.5rem')
4040
})
4141

4242
it('should should stack horizontally if isInline', () => {
4343
const inlineAttrs = 'is-inline'
44-
const { getByTestId } = renderComponent({ inlineAttrs })
45-
const stack = getByTestId('stack')
44+
renderComponent({ inlineAttrs })
45+
const stack = screen.getByTestId('stack')
4646
expect(stack).toHaveStyle('display: flex')
4747
expect(stack).toHaveStyle('flex-direction: row')
4848
})
@@ -58,8 +58,8 @@ it.each`
5858
'should render CStack with element as $as',
5959
({ as }) => {
6060
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')
6363
expect(getTagName(stack)).toEqual(as)
6464
expect(asFragment()).toMatchSnapshot()
6565
}

0 commit comments

Comments
 (0)