File tree Expand file tree Collapse file tree 2 files changed +31
-3
lines changed
packages/vuetify/src/components/VCombobox Expand file tree Collapse file tree 2 files changed +31
-3
lines changed Original file line number Diff line number Diff line change @@ -214,10 +214,10 @@ export default VAutocomplete.extend({
214214
215215 // If the user is not searching
216216 // and no menu item is selected
217+ // or if the search is empty
217218 // do nothing
218- if ( menuIndex < 0 &&
219- ! this . searchIsDirty
220- ) return
219+ if ( ( menuIndex < 0 && ! this . searchIsDirty ) ||
220+ ! this . internalSearch ) return
221221
222222 if ( this . editingIndex > - 1 ) {
223223 return this . updateEditing ( )
Original file line number Diff line number Diff line change @@ -455,4 +455,32 @@ describe('VCombobox.ts', () => {
455455 await wrapper . vm . $nextTick ( )
456456 expect ( change ) . toHaveBeenLastCalledWith ( [ 'foo' , 'bar' ] )
457457 } )
458+
459+ // https://github.com/vuetifyjs/vuetify/issues/13274
460+ it ( 'should not add empty values' , async ( ) => {
461+ const { wrapper, change } = createMultipleCombobox ( {
462+ chips : true ,
463+ multiple : true ,
464+ items : [ 'foo' ] ,
465+ value : [ 'foo' ] ,
466+ } )
467+
468+ const input = wrapper . find ( 'input' )
469+ const element = input . element as HTMLInputElement
470+
471+ // Add a value and then remove it
472+ input . trigger ( 'focus' )
473+ element . value = 'a'
474+ input . trigger ( 'input' )
475+ await wrapper . vm . $nextTick ( )
476+ element . value = ''
477+ input . trigger ( 'input' )
478+ await wrapper . vm . $nextTick ( )
479+
480+ // Lose focus
481+ input . trigger ( 'keydown.tab' )
482+ await wrapper . vm . $nextTick ( )
483+
484+ expect ( change ) . not . toHaveBeenCalled ( )
485+ } )
458486} )
You can’t perform that action at this time.
0 commit comments