@@ -347,8 +347,10 @@ describe('form-checkbox-group', () => {
347
347
attachTo : createContainer ( ) ,
348
348
global,
349
349
props : {
350
- 'options' : [ 'one' , 'two' , 'three' ] ,
351
- 'modelValue' : [ ] ,
350
+ options : [ 'one' , 'two' , 'three' ] ,
351
+ modelValue : [ ] ,
352
+ } ,
353
+ attrs : {
352
354
'onUpdate:modelValue' : ( modelValue ) => wrapper . setProps ( { modelValue} ) ,
353
355
} ,
354
356
} )
@@ -392,55 +394,6 @@ describe('form-checkbox-group', () => {
392
394
wrapper . unmount ( )
393
395
} )
394
396
395
- it ( 'does not emit "input" event when value loosely changes' , async ( ) => {
396
- const value = [ 'one' , 'two' , 'three' ]
397
- const wrapper = mount ( BFormCheckboxGroup , {
398
- attachTo : createContainer ( ) ,
399
- global,
400
- props : {
401
- 'options' : value . slice ( ) ,
402
- 'modelValue' : value . slice ( ) ,
403
- 'onUpdate:modelValue' : ( modelValue ) => wrapper . setProps ( { modelValue} ) ,
404
- } ,
405
- } )
406
-
407
- expect ( wrapper . classes ( ) ) . toBeDefined ( )
408
-
409
- const $inputs = wrapper . findAll ( 'input[type=checkbox]' )
410
- expect ( $inputs . length ) . toBe ( 3 )
411
- expect ( wrapper . vm . modelValue ) . toEqual ( value )
412
- expect ( $inputs [ 0 ] . element . checked ) . toBe ( true )
413
- expect ( $inputs [ 1 ] . element . checked ) . toBe ( true )
414
- expect ( $inputs [ 2 ] . element . checked ) . toBe ( true )
415
-
416
- expect ( wrapper . emitted ( 'update:modelValue' ) ) . toBeUndefined ( )
417
-
418
- // Set internal value to new array reference
419
- wrapper . vm . localChecked = value . slice ( )
420
- await waitNT ( wrapper . vm )
421
-
422
- expect ( wrapper . vm . modelValue ) . toEqual ( value )
423
- expect ( $inputs [ 0 ] . element . checked ) . toBe ( true )
424
- expect ( $inputs [ 1 ] . element . checked ) . toBe ( true )
425
- expect ( $inputs [ 2 ] . element . checked ) . toBe ( true )
426
-
427
- expect ( wrapper . emitted ( 'update:modelValue' ) ) . toBeUndefined ( )
428
-
429
- // Set internal value to new array (reversed order)
430
- wrapper . vm . localChecked = value . slice ( ) . reverse ( )
431
- await waitNT ( wrapper . vm )
432
-
433
- expect ( wrapper . vm . modelValue ) . toEqual ( value . slice ( ) . reverse ( ) )
434
- expect ( $inputs [ 0 ] . element . checked ) . toBe ( true )
435
- expect ( $inputs [ 1 ] . element . checked ) . toBe ( true )
436
- expect ( $inputs [ 2 ] . element . checked ) . toBe ( true )
437
- expect ( wrapper . emitted ( 'update:modelValue' ) ) . toBeDefined ( )
438
- expect ( wrapper . emitted ( 'update:modelValue' ) . length ) . toBe ( 1 )
439
- expect ( wrapper . emitted ( 'update:modelValue' ) [ 0 ] [ 0 ] ) . toEqual ( value . slice ( ) . reverse ( ) )
440
-
441
- wrapper . unmount ( )
442
- } )
443
-
444
397
it ( 'checkboxes reflect group checked v-model' , async ( ) => {
445
398
const wrapper = mount ( BFormCheckboxGroup , {
446
399
attachTo : createContainer ( ) ,
@@ -455,13 +408,13 @@ describe('form-checkbox-group', () => {
455
408
456
409
const $inputs = wrapper . findAll ( 'input[type=checkbox]' )
457
410
expect ( $inputs . length ) . toBe ( 3 )
458
- expect ( wrapper . vm . localChecked ) . toEqual ( [ 'two' ] )
411
+ expect ( wrapper . vm . modelValue ) . toEqual ( [ 'two' ] )
459
412
expect ( $inputs [ 0 ] . element . checked ) . toBe ( false )
460
413
expect ( $inputs [ 1 ] . element . checked ) . toBe ( true )
461
414
expect ( $inputs [ 2 ] . element . checked ) . toBe ( false )
462
415
463
416
await wrapper . setProps ( { modelValue : [ 'three' , 'one' ] } )
464
- expect ( wrapper . vm . localChecked ) . toEqual ( [ 'three' , 'one' ] )
417
+ expect ( wrapper . vm . modelValue ) . toEqual ( [ 'three' , 'one' ] )
465
418
expect ( $inputs [ 0 ] . element . checked ) . toBe ( true )
466
419
expect ( $inputs [ 1 ] . element . checked ) . toBe ( false )
467
420
expect ( $inputs [ 2 ] . element . checked ) . toBe ( true )
@@ -481,7 +434,7 @@ describe('form-checkbox-group', () => {
481
434
} )
482
435
483
436
expect ( wrapper . classes ( ) ) . toBeDefined ( )
484
- expect ( wrapper . vm . localChecked ) . toEqual ( [ ] )
437
+ expect ( wrapper . vm . modelValue ) . toEqual ( [ ] )
485
438
486
439
const $inputs = wrapper . findAll ( 'input[type=checkbox]' )
487
440
expect ( $inputs . length ) . toBe ( 3 )
@@ -503,7 +456,7 @@ describe('form-checkbox-group', () => {
503
456
} ,
504
457
} )
505
458
506
- expect ( wrapper . vm . localChecked ) . toEqual ( [ ] )
459
+ expect ( wrapper . vm . modelValue ) . toEqual ( [ ] )
507
460
508
461
const $inputs = wrapper . findAll ( 'input[type=checkbox]' )
509
462
expect ( $inputs . length ) . toBe ( 3 )
@@ -525,7 +478,7 @@ describe('form-checkbox-group', () => {
525
478
} ,
526
479
} )
527
480
528
- expect ( wrapper . vm . localChecked ) . toEqual ( [ ] )
481
+ expect ( wrapper . vm . modelValue ) . toEqual ( [ ] )
529
482
530
483
const $inputs = wrapper . findAll ( 'input[type=checkbox]' )
531
484
expect ( $inputs . length ) . toBe ( 3 )
@@ -548,7 +501,7 @@ describe('form-checkbox-group', () => {
548
501
} ,
549
502
} )
550
503
551
- expect ( wrapper . vm . localChecked ) . toEqual ( [ ] )
504
+ expect ( wrapper . vm . modelValue ) . toEqual ( [ ] )
552
505
553
506
const $inputs = wrapper . findAll ( 'input[type=checkbox]' )
554
507
expect ( $inputs . length ) . toBe ( 3 )
0 commit comments