@@ -475,31 +475,59 @@ describe('Select.Multiple', () => {
475
475
expect ( wrapper . exists ( '.rc-select-selection-item-remove' ) ) . toBeFalsy ( ) ;
476
476
} ) ;
477
477
478
- it ( 'optionLabelProp' , ( ) => {
479
- const wrapper = mount (
480
- < Select
481
- mode = "multiple"
482
- value = { [ 'bamboo' , 'little' ] }
483
- open
484
- optionLabelProp = "selector"
485
- options = { [
486
- {
487
- label : 'Bamboo' ,
488
- value : 'bamboo' ,
489
- selector : 'BAMBOO' ,
490
- } ,
491
- {
492
- label : 'Little' ,
493
- value : 'little' ,
494
- selector : 'LITTLE' ,
495
- } ,
496
- ] }
497
- /> ,
498
- ) ;
478
+ describe ( 'optionLabelProp' , ( ) => {
479
+ it ( 'basic' , ( ) => {
480
+ const wrapper = mount (
481
+ < Select
482
+ mode = "multiple"
483
+ value = { [ 'bamboo' , 'little' ] }
484
+ open
485
+ optionLabelProp = "selector"
486
+ options = { [
487
+ {
488
+ label : 'Bamboo' ,
489
+ value : 'bamboo' ,
490
+ selector : 'BAMBOO' ,
491
+ } ,
492
+ {
493
+ label : 'Little' ,
494
+ value : 'little' ,
495
+ selector : 'LITTLE' ,
496
+ } ,
497
+ ] }
498
+ /> ,
499
+ ) ;
499
500
500
- expect ( findSelection ( wrapper , 0 ) . text ( ) ) . toBe ( 'BAMBOO' ) ;
501
- expect ( findSelection ( wrapper , 1 ) . text ( ) ) . toBe ( 'LITTLE' ) ;
502
- expect ( wrapper . find ( 'div.rc-select-item-option-content' ) . at ( 0 ) . text ( ) ) . toBe ( 'Bamboo' ) ;
503
- expect ( wrapper . find ( 'div.rc-select-item-option-content' ) . at ( 1 ) . text ( ) ) . toBe ( 'Little' ) ;
501
+ expect ( findSelection ( wrapper , 0 ) . text ( ) ) . toBe ( 'BAMBOO' ) ;
502
+ expect ( findSelection ( wrapper , 1 ) . text ( ) ) . toBe ( 'LITTLE' ) ;
503
+ expect ( wrapper . find ( 'div.rc-select-item-option-content' ) . at ( 0 ) . text ( ) ) . toBe ( 'Bamboo' ) ;
504
+ expect ( wrapper . find ( 'div.rc-select-item-option-content' ) . at ( 1 ) . text ( ) ) . toBe ( 'Little' ) ;
505
+ } ) ;
506
+
507
+ it ( 'select no warning' , ( ) => {
508
+ const wrapper = mount (
509
+ < Select
510
+ mode = "multiple"
511
+ open
512
+ optionLabelProp = "selector"
513
+ options = { [
514
+ {
515
+ label : 'Bamboo' ,
516
+ value : 'bamboo' ,
517
+ selector : 'BAMBOO' ,
518
+ } ,
519
+ ] }
520
+ /> ,
521
+ ) ;
522
+
523
+ // Select one
524
+ const errSpy = jest . spyOn ( console , 'error' ) ;
525
+
526
+ toggleOpen ( wrapper ) ;
527
+ selectItem ( wrapper ) ;
528
+
529
+ expect ( errSpy ) . not . toHaveBeenCalled ( ) ;
530
+ errSpy . mockRestore ( ) ;
531
+ } ) ;
504
532
} ) ;
505
533
} ) ;
0 commit comments