File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -434,7 +434,10 @@ export default function generateSelector<
434
434
optionFilterProp,
435
435
filterOption : mode === 'combobox' && filterOption === undefined ? ( ) => true : filterOption ,
436
436
} ) ;
437
- if ( mode === 'tags' && filteredOptions . every ( opt => opt . value !== mergedSearchValue ) ) {
437
+ if (
438
+ mode === 'tags' &&
439
+ filteredOptions . every ( opt => opt [ optionFilterProp ] !== mergedSearchValue )
440
+ ) {
438
441
filteredOptions . unshift ( {
439
442
value : mergedSearchValue ,
440
443
label : mergedSearchValue ,
Original file line number Diff line number Diff line change @@ -224,6 +224,21 @@ describe('Select.Tags', () => {
224
224
] ) ;
225
225
} ) ;
226
226
227
+ it ( 'renders options matched with optionFilterProp' , ( ) => {
228
+ const wrapper = mount (
229
+ < Select open value = "22" mode = "tags" searchValue = "option-1" optionFilterProp = "children" >
230
+ < Option value = "1" > option-1</ Option >
231
+ < Option value = "2" > option-2</ Option >
232
+ </ Select > ,
233
+ ) ;
234
+
235
+ expect ( wrapper . find ( 'List' ) . props ( ) . data ) . toEqual ( [
236
+ expect . objectContaining ( {
237
+ data : expect . objectContaining ( { value : '1' } ) ,
238
+ } ) ,
239
+ ] ) ;
240
+ } ) ;
241
+
227
242
it ( 'use filterOption' , ( ) => {
228
243
const filterOption = ( inputValue , option ) =>
229
244
option . value . toLowerCase ( ) . indexOf ( inputValue . toLowerCase ( ) ) !== - 1 ;
You can’t perform that action at this time.
0 commit comments