File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -229,6 +229,13 @@ const Select = React.forwardRef(
229
229
const multiple = isMultiple ( mode ) ;
230
230
const childrenAsData = ! ! ( ! options && children ) ;
231
231
232
+ const mergedFilterOption = React . useMemo ( ( ) => {
233
+ if ( filterOption === undefined && mode === 'combobox' ) {
234
+ return false ;
235
+ }
236
+ return filterOption ;
237
+ } , [ filterOption , mode ] ) ;
238
+
232
239
// ========================= FieldNames =========================
233
240
const mergedFieldNames = React . useMemo (
234
241
( ) => fillFieldNames ( fieldNames , childrenAsData ) ,
@@ -396,7 +403,7 @@ const Select = React.forwardRef(
396
403
filledTagOptions ,
397
404
mergedFieldNames ,
398
405
mergedSearchValue ,
399
- filterOption ,
406
+ mergedFilterOption ,
400
407
optionFilterProp ,
401
408
) ;
402
409
Original file line number Diff line number Diff line change @@ -485,4 +485,26 @@ describe('Select.Combobox', () => {
485
485
wrapper . find ( 'input' ) . simulate ( 'compositionEnd' , { target : { value : '啊' } } ) ;
486
486
expect ( onChange ) . toHaveBeenCalledTimes ( 2 ) ;
487
487
} ) ;
488
+
489
+ it ( 'default filterOption is false' , ( ) => {
490
+ const wrapper = mount (
491
+ < Select
492
+ mode = "combobox"
493
+ open
494
+ searchValue = "not exist"
495
+ options = { [
496
+ {
497
+ label : 'Light' ,
498
+ value : 'light' ,
499
+ } ,
500
+ {
501
+ label : 'Bamboo' ,
502
+ value : 'bamboo' ,
503
+ } ,
504
+ ] }
505
+ /> ,
506
+ ) ;
507
+
508
+ expect ( wrapper . find ( 'List' ) . prop ( 'data' ) ) . toHaveLength ( 2 ) ;
509
+ } ) ;
488
510
} ) ;
You can’t perform that action at this time.
0 commit comments