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

Commit 1af9a07

Browse files
committed
test(controlbox): refactor use screen
1 parent 725f822 commit 1af9a07

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

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

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

44
const renderComponent = (props) => {
55
const inlineAttrs = (props && props.inlineAttrs) || ''
@@ -43,9 +43,9 @@ it('should render correctly', () => {
4343
})
4444

4545
test('Uncontrolled radio - should be checked always', async () => {
46-
const { getByTestId } = renderComponent({ type: 'radio' })
47-
const control = getByTestId('control')
48-
const hiddenControl = getByTestId('hiddenControl')
46+
renderComponent({ type: 'radio' })
47+
const control = screen.getByTestId('control')
48+
const hiddenControl = screen.getByTestId('hiddenControl')
4949

5050
// click the first time, it's checked
5151
await userEvent.click(control)
@@ -57,9 +57,9 @@ test('Uncontrolled radio - should be checked always', async () => {
5757
})
5858

5959
test('Uncontrolled checkbox - should toggle', async () => {
60-
const { getByTestId } = renderComponent({ type: 'checkbox' })
61-
const control = getByTestId('control')
62-
const hiddenControl = getByTestId('hiddenControl')
60+
renderComponent({ type: 'checkbox' })
61+
const control = screen.getByTestId('control')
62+
const hiddenControl = screen.getByTestId('hiddenControl')
6363

6464
// click the first time, it's checked
6565
await userEvent.click(control)
@@ -72,9 +72,9 @@ test('Uncontrolled checkbox - should toggle', async () => {
7272

7373
test('controlled checkbox - v-model works', async () => {
7474
const inlineAttrs = ':checked="checked"'
75-
const { getByTestId } = renderComponent({ inlineAttrs, type: 'checkbox', data: () => ({ checked: true }) })
76-
const control = getByTestId('control')
77-
const hiddenControl = getByTestId('hiddenControl')
75+
renderComponent({ inlineAttrs, type: 'checkbox', data: () => ({ checked: true }) })
76+
const control = screen.getByTestId('control')
77+
const hiddenControl = screen.getByTestId('hiddenControl')
7878

7979
// click the first time, it's checked
8080
expect(hiddenControl).toBeChecked()
@@ -86,9 +86,9 @@ test('controlled checkbox - v-model works', async () => {
8686

8787
test('controlled radio - v-model works', async () => {
8888
const inlineAttrs = ':checked="checked"'
89-
const { getByTestId } = renderComponent({ inlineAttrs, type: 'radio', data: () => ({ checked: true }) })
90-
const control = getByTestId('control')
91-
const hiddenControl = getByTestId('hiddenControl')
89+
renderComponent({ inlineAttrs, type: 'radio', data: () => ({ checked: true }) })
90+
const control = screen.getByTestId('control')
91+
const hiddenControl = screen.getByTestId('hiddenControl')
9292

9393
// click the first time, it's checked
9494
expect(hiddenControl).toBeChecked()

0 commit comments

Comments
 (0)