@@ -223,7 +223,7 @@ describe('Checkbox', () => {
223
223
} )
224
224
225
225
describe ( 'onChange' , ( ) => {
226
- it ( 'is called with (e, data) on mouse up' , ( ) => {
226
+ it ( 'is called on mouse up' , ( ) => {
227
227
const onChange = sandbox . spy ( )
228
228
const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
229
229
@@ -233,17 +233,10 @@ describe('Checkbox', () => {
233
233
wrapper . find ( 'label' ) . simulate ( 'click' )
234
234
235
235
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 )
244
237
} )
245
238
246
- it ( 'is not called when on change when "id" is passed' , ( ) => {
239
+ it ( 'is not called on change when "id" is passed' , ( ) => {
247
240
const onChange = sandbox . spy ( )
248
241
wrapperMount ( < Checkbox id = 'foo' onChange = { onChange } /> )
249
242
@@ -264,22 +257,16 @@ describe('Checkbox', () => {
264
257
} )
265
258
266
259
describe ( 'onClick' , ( ) => {
267
- it ( 'is called with (event, data) on click' , ( ) => {
260
+ it ( 'is called on click' , ( ) => {
268
261
const onClick = sandbox . spy ( )
269
262
const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
270
263
mount ( < Checkbox onClick = { onClick } { ...props } /> ) . simulate ( 'click' )
271
264
272
265
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 )
280
267
} )
281
268
282
- it ( 'is not called when "id" is passed' , ( ) => {
269
+ it ( 'is not called on click if "id" is passed' , ( ) => {
283
270
const onClick = sandbox . spy ( )
284
271
wrapperMount ( < Checkbox id = 'foo' onClick = { onClick } /> )
285
272
@@ -290,13 +277,13 @@ describe('Checkbox', () => {
290
277
} )
291
278
292
279
describe ( 'onMouseDown' , ( ) => {
293
- it ( 'is called with (event, data) on mouse down' , ( ) => {
280
+ it ( 'is called on mouse down without changing the checked status ' , ( ) => {
294
281
const onMousedDown = sandbox . spy ( )
295
282
const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
296
283
mount ( < Checkbox onMouseDown = { onMousedDown } { ...props } /> ) . simulate ( 'mousedown' )
297
284
298
285
onMousedDown . should . have . been . calledOnce ( )
299
- onMousedDown . should . have . been . calledWithMatch ( { } , props )
286
+ onMousedDown . should . have . been . calledWithMatch ( { } , props , false , true )
300
287
} )
301
288
302
289
it ( 'sets focus to container' , ( ) => {
@@ -307,7 +294,7 @@ describe('Checkbox', () => {
307
294
document . activeElement . should . equal ( input )
308
295
} )
309
296
310
- it ( 'will not set focus to container, if default is prevented' , ( ) => {
297
+ it ( 'does not set focus to container, if default is prevented' , ( ) => {
311
298
wrapperMount ( < Checkbox onMouseDown = { ( e ) => e . preventDefault ( ) } /> )
312
299
313
300
domEvent . fire ( '.ui.checkbox input' , 'mousedown' )
@@ -316,20 +303,24 @@ describe('Checkbox', () => {
316
303
} )
317
304
318
305
describe ( 'onMouseUp' , ( ) => {
319
- it ( 'is called with (event, data) on mouse up' , ( ) => {
306
+ it ( 'is called on mouse up without changing the checked status ' , ( ) => {
320
307
const onMouseUp = sandbox . spy ( )
321
308
const props = { name : 'foo' , value : 'bar' , checked : false , indeterminate : true }
322
309
mount ( < Checkbox onMouseUp = { onMouseUp } { ...props } /> ) . simulate ( 'mouseup' )
323
310
324
311
onMouseUp . should . have . been . calledOnce ( )
325
- onMouseUp . should . have . been . calledWithMatch ( { } , props )
312
+ onMouseUp . should . have . been . calledWithMatch ( { } , props , false , true )
326
313
} )
327
314
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 ' , ( ) => {
329
316
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
+ } )
331
321
332
322
onMouseUp . should . have . been . calledOnce ( )
323
+ onMouseUp . should . have . been . calledWithMatch ( { } , props , false , true )
333
324
} )
334
325
} )
335
326
0 commit comments