1
1
import { CVisuallyHidden , CControlBox , CBox } from '../..'
2
- import { render , userEvent } from '@/tests/test-utils'
2
+ import { render , userEvent , screen } from '@/tests/test-utils'
3
3
4
4
const renderComponent = ( props ) => {
5
5
const inlineAttrs = ( props && props . inlineAttrs ) || ''
@@ -43,9 +43,9 @@ it('should render correctly', () => {
43
43
} )
44
44
45
45
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' )
49
49
50
50
// click the first time, it's checked
51
51
await userEvent . click ( control )
@@ -57,9 +57,9 @@ test('Uncontrolled radio - should be checked always', async () => {
57
57
} )
58
58
59
59
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' )
63
63
64
64
// click the first time, it's checked
65
65
await userEvent . click ( control )
@@ -72,9 +72,9 @@ test('Uncontrolled checkbox - should toggle', async () => {
72
72
73
73
test ( 'controlled checkbox - v-model works' , async ( ) => {
74
74
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' )
78
78
79
79
// click the first time, it's checked
80
80
expect ( hiddenControl ) . toBeChecked ( )
@@ -86,9 +86,9 @@ test('controlled checkbox - v-model works', async () => {
86
86
87
87
test ( 'controlled radio - v-model works' , async ( ) => {
88
88
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' )
92
92
93
93
// click the first time, it's checked
94
94
expect ( hiddenControl ) . toBeChecked ( )
0 commit comments