@@ -223,7 +223,7 @@ describe('Checkbox', () => {
223223 } )
224224
225225 describe ( 'onChange' , ( ) => {
226- it ( 'is called with (e, data) on mouse up' , ( ) => {
226+ it ( 'is called on mouse up' , ( ) => {
227227 const onChange = sandbox . spy ( )
228228 const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
229229
@@ -233,17 +233,10 @@ describe('Checkbox', () => {
233233 wrapper . find ( 'label' ) . simulate ( 'click' )
234234
235235 onChange . should . have . been . calledOnce ( )
236- onChange . should . have . been . calledWithMatch (
237- { } ,
238- {
239- ...props ,
240- checked : true ,
241- indeterminate : false ,
242- } ,
243- )
236+ onChange . should . have . been . calledWithMatch ( { } , props , true , false )
244237 } )
245238
246- it ( 'is not called when on change when "id" is passed' , ( ) => {
239+ it ( 'is not called on change when "id" is passed' , ( ) => {
247240 const onChange = sandbox . spy ( )
248241 wrapperMount ( < Checkbox id = 'foo' onChange = { onChange } /> )
249242
@@ -264,22 +257,16 @@ describe('Checkbox', () => {
264257 } )
265258
266259 describe ( 'onClick' , ( ) => {
267- it ( 'is called with (event, data) on click' , ( ) => {
260+ it ( 'is called on click' , ( ) => {
268261 const onClick = sandbox . spy ( )
269262 const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
270263 mount ( < Checkbox onClick = { onClick } { ...props } /> ) . simulate ( 'click' )
271264
272265 onClick . should . have . been . calledOnce ( )
273- onClick . should . have . been . calledWithMatch (
274- { } ,
275- {
276- ...props ,
277- checked : true ,
278- } ,
279- )
266+ onClick . should . have . been . calledWithMatch ( { } , props , true , true )
280267 } )
281268
282- it ( 'is not called when "id" is passed' , ( ) => {
269+ it ( 'is not called on click if "id" is passed' , ( ) => {
283270 const onClick = sandbox . spy ( )
284271 wrapperMount ( < Checkbox id = 'foo' onClick = { onClick } /> )
285272
@@ -290,13 +277,13 @@ describe('Checkbox', () => {
290277 } )
291278
292279 describe ( 'onMouseDown' , ( ) => {
293- it ( 'is called with (event, data) on mouse down' , ( ) => {
280+ it ( 'is called on mouse down without changing the checked status ' , ( ) => {
294281 const onMousedDown = sandbox . spy ( )
295282 const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
296283 mount ( < Checkbox onMouseDown = { onMousedDown } { ...props } /> ) . simulate ( 'mousedown' )
297284
298285 onMousedDown . should . have . been . calledOnce ( )
299- onMousedDown . should . have . been . calledWithMatch ( { } , props )
286+ onMousedDown . should . have . been . calledWithMatch ( { } , props , false , true )
300287 } )
301288
302289 it ( 'sets focus to container' , ( ) => {
@@ -307,7 +294,7 @@ describe('Checkbox', () => {
307294 document . activeElement . should . equal ( input )
308295 } )
309296
310- it ( 'will not set focus to container, if default is prevented' , ( ) => {
297+ it ( 'does not set focus to container, if default is prevented' , ( ) => {
311298 wrapperMount ( < Checkbox onMouseDown = { ( e ) => e . preventDefault ( ) } /> )
312299
313300 domEvent . fire ( '.ui.checkbox input' , 'mousedown' )
@@ -316,20 +303,24 @@ describe('Checkbox', () => {
316303 } )
317304
318305 describe ( 'onMouseUp' , ( ) => {
319- it ( 'is called with (event, data) on mouse up' , ( ) => {
306+ it ( 'is called on mouse up without changing the checked status ' , ( ) => {
320307 const onMouseUp = sandbox . spy ( )
321308 const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
322309 mount ( < Checkbox onMouseUp = { onMouseUp } { ...props } /> ) . simulate ( 'mouseup' )
323310
324311 onMouseUp . should . have . been . calledOnce ( )
325- onMouseUp . should . have . been . calledWithMatch ( { } , props )
312+ onMouseUp . should . have . been . calledWithMatch ( { } , props , false , true )
326313 } )
327314
328- it ( 'is called with (event, data) on mouse up with right button' , ( ) => {
315+ it ( 'is called on mouse up with right button without changing the checked status ' , ( ) => {
329316 const onMouseUp = sandbox . spy ( )
330- mount ( < Checkbox id = 'foo' onMouseUp = { onMouseUp } /> ) . simulate ( 'mouseup' , { button : 2 } )
317+ const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
318+ mount ( < Checkbox id = 'foo' onMouseUp = { onMouseUp } { ...props } /> ) . simulate ( 'mouseup' , {
319+ button : 2 ,
320+ } )
331321
332322 onMouseUp . should . have . been . calledOnce ( )
323+ onMouseUp . should . have . been . calledWithMatch ( { } , props , false , true )
333324 } )
334325 } )
335326
0 commit comments