@@ -432,77 +432,4 @@ describe('v-if', function () {
432
432
done ( )
433
433
} )
434
434
} )
435
-
436
- // GitHub issue #3204
437
- it ( 'update array refs' , function ( done ) {
438
- var vm = new Vue ( {
439
- el : el ,
440
- template : '<foo v-if="!activeItem || $index === activeItem" v-ref:foo :index="$index" v-for="item in items"></foo>' ,
441
- data : {
442
- items : [ 0 , 1 , 2 ] ,
443
- activeItem : null
444
- } ,
445
- components : {
446
- foo : {
447
- props : [ 'index' ] ,
448
- template : '<div>I am foo ({{ index }})<div>'
449
- }
450
- }
451
- } )
452
- vm . $refs . foo . forEach ( function ( ref , index ) {
453
- expect ( ref . $el . textContent ) . toBe ( 'I am foo (' + index + ')' )
454
- expect ( ref . index ) . toBe ( index )
455
- } )
456
- vm . activeItem = 1 // select active item
457
- nextTick ( function ( ) {
458
- expect ( vm . $refs . foo . length ) . toBe ( 1 )
459
- expect ( vm . $refs . foo [ 0 ] . index ) . toBe ( 1 )
460
- vm . activeItem = null // enable all elements
461
- nextTick ( function ( ) {
462
- expect ( vm . $refs . foo . length ) . toBe ( 3 )
463
- done ( )
464
- } )
465
- } )
466
- } )
467
-
468
- it ( 'update object refs' , function ( done ) {
469
- var vm = new Vue ( {
470
- el : el ,
471
- template : '<foo v-if="!activeKey || $key === activeKey" v-ref:foo :key="$key" v-for="item in items"></foo>' ,
472
- data : {
473
- items : {
474
- a : 1 ,
475
- b : 2 ,
476
- c : 3
477
- } ,
478
- activeKey : null
479
- } ,
480
- components : {
481
- foo : {
482
- props : [ 'key' ] ,
483
- template : '<div>I am foo ({{ key }})<div>'
484
- }
485
- }
486
- } )
487
- Object . keys ( vm . $refs . foo ) . forEach ( function ( key ) {
488
- var ref = vm . $refs . foo [ key ]
489
- expect ( ref . $el . textContent ) . toBe ( 'I am foo (' + key + ')' )
490
- expect ( ref . key ) . toBe ( key )
491
- } )
492
- vm . activeKey = 'b' // select active item
493
- nextTick ( function ( ) {
494
- expect ( Object . keys ( vm . $refs . foo ) . length ) . toBe ( 1 )
495
- expect ( vm . $refs . foo [ 'b' ] . key ) . toBe ( 'b' )
496
- vm . activeKey = null // enable all elements
497
- nextTick ( function ( ) {
498
- expect ( Object . keys ( vm . $refs . foo ) . length ) . toBe ( 3 )
499
- Object . keys ( vm . $refs . foo ) . forEach ( function ( key ) {
500
- var ref = vm . $refs . foo [ key ]
501
- expect ( ref . $el . textContent ) . toBe ( 'I am foo (' + key + ')' )
502
- expect ( ref . key ) . toBe ( key )
503
- } )
504
- done ( )
505
- } )
506
- } )
507
- } )
508
435
} )
0 commit comments