File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
src/components/primitives/Checkbox Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -15,4 +15,27 @@ describe('Checkbox', () => {
15
15
it ( 'render correctly' , ( ) => {
16
16
expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
17
17
} )
18
+
19
+ it ( 'has an input checkbox' , ( ) => {
20
+ expect ( wrapper . html ( ) ) . toContain ( 'input type="checkbox"' )
21
+ } )
22
+
23
+ it ( 'emit input event with value when value change' , async ( ) => {
24
+ wrapper . setProps ( { modelValue : true } )
25
+ await wrapper . vm . $nextTick ( )
26
+ expect ( wrapper . vm . value ) . toBeTruthy ( )
27
+
28
+ wrapper . vm . value = false
29
+ await wrapper . vm . $nextTick ( )
30
+
31
+ const valueEmitted = wrapper . emitted ( ) [ 'update:modelValue' ] [ 2 ]
32
+ expect ( valueEmitted ) . toContainEqual ( false )
33
+ } )
34
+
35
+ it ( 'method focus() gives focus to the input element' , async ( ) => {
36
+ wrapper . vm . $refs . input . focus = jest . fn ( )
37
+ wrapper . vm . focus ( )
38
+ await wrapper . vm . $nextTick ( )
39
+ expect ( wrapper . vm . $refs . input . focus ) . toHaveBeenCalledTimes ( 1 )
40
+ } )
18
41
} )
You can’t perform that action at this time.
0 commit comments