@@ -55,6 +55,28 @@ describeWithShallowAndMount('setChecked', mountingMethod => {
55
55
expect ( wrapper . find ( '.counter' ) . text ( ) ) . to . equal ( '4' )
56
56
} )
57
57
58
+ it ( 'should trigger a change event when called on a checkbox' , ( ) => {
59
+ const listeners = { change : sinon . spy ( ) }
60
+ const input = mountingMethod ( {
61
+ template : `<input type="checkbox" v-on="$listeners">` ,
62
+ } , { listeners } )
63
+
64
+ input . setChecked ( )
65
+
66
+ expect ( listeners . change ) . to . have . been . called
67
+ } ) ;
68
+
69
+ it ( 'should not trigger a change event if the checkbox is already checked' , ( ) => {
70
+ const listeners = { change : sinon . spy ( ) }
71
+ const input = mountingMethod ( {
72
+ template : `<input type="checkbox" checked v-on="$listeners">` ,
73
+ } , { listeners } )
74
+
75
+ input . setChecked ( )
76
+
77
+ expect ( listeners . change ) . not . to . have . been . called
78
+ } ) ;
79
+
58
80
it ( 'updates dom with radio v-model' , async ( ) => {
59
81
const wrapper = mountingMethod ( ComponentWithInput )
60
82
@@ -67,7 +89,7 @@ describeWithShallowAndMount('setChecked', mountingMethod => {
67
89
expect ( wrapper . text ( ) ) . to . contain ( 'radioFooResult' )
68
90
} )
69
91
70
- it ( 'changes state the right amount of times with checkbox v-model' , async ( ) => {
92
+ it ( 'changes state the right amount of times with radio v-model' , async ( ) => {
71
93
const wrapper = mountingMethod ( ComponentWithInput )
72
94
const radioBar = wrapper . find ( '#radioBar' )
73
95
const radioFoo = wrapper . find ( '#radioFoo' )
0 commit comments