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(
229229 const multiple = isMultiple ( mode ) ;
230230 const childrenAsData = ! ! ( ! options && children ) ;
231231
232+ const mergedFilterOption = React . useMemo ( ( ) => {
233+ if ( filterOption === undefined && mode === 'combobox' ) {
234+ return false ;
235+ }
236+ return filterOption ;
237+ } , [ filterOption , mode ] ) ;
238+
232239 // ========================= FieldNames =========================
233240 const mergedFieldNames = React . useMemo (
234241 ( ) => fillFieldNames ( fieldNames , childrenAsData ) ,
@@ -396,7 +403,7 @@ const Select = React.forwardRef(
396403 filledTagOptions ,
397404 mergedFieldNames ,
398405 mergedSearchValue ,
399- filterOption ,
406+ mergedFilterOption ,
400407 optionFilterProp ,
401408 ) ;
402409
Original file line number Diff line number Diff line change @@ -485,4 +485,26 @@ describe('Select.Combobox', () => {
485485 wrapper . find ( 'input' ) . simulate ( 'compositionEnd' , { target : { value : '啊' } } ) ;
486486 expect ( onChange ) . toHaveBeenCalledTimes ( 2 ) ;
487487 } ) ;
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+ } ) ;
488510} ) ;
You can’t perform that action at this time.
0 commit comments