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

Commit 57dd80e

Browse files
committed
test(radio-button-group): refactor use screen
1 parent a1fad2a commit 57dd80e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

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

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

44
const CustomRadio = {
55
name: 'CustomRadio',
@@ -55,29 +55,29 @@ it('should render correctly', () => {
5555
})
5656

5757
it('should display children', () => {
58-
const { getByText } = renderComponent()
59-
expect(getByText('Custom Radio 1')).toBeInTheDocument()
60-
expect(getByText('Custom Radio 2')).toBeInTheDocument()
58+
renderComponent()
59+
expect(screen.getByText('Custom Radio 1')).toBeInTheDocument()
60+
expect(screen.getByText('Custom Radio 2')).toBeInTheDocument()
6161
})
6262

6363
test('v-model works', () => {
64-
const { getByTestId } = renderComponent({
64+
renderComponent({
6565
data () {
6666
return {
6767
selected: 'item-2'
6868
}
6969
}
7070
})
71-
const one = getByTestId('item-1')
72-
const two = getByTestId('item-2')
71+
const one = screen.getByTestId('item-1')
72+
const two = screen.getByTestId('item-2')
7373

7474
expect(one).not.toHaveAttribute('aria-checked')
7575
expect(two).toHaveAttribute('aria-checked', 'true')
7676
})
7777

7878
test('CustomRadio isDisabled works', () => {
79-
const { getByTestId } = renderComponent()
80-
const last = getByTestId('item-4')
79+
renderComponent()
80+
const last = screen.getByTestId('item-4')
8181

8282
expect(last).toHaveAttribute('disabled')
8383
})

0 commit comments

Comments
 (0)