Skip to content

Commit

Permalink
fix(VFileInput): set value to undefined by default and on clear
Browse files Browse the repository at this point in the history
matches the default behavior of <input type="file">

fixes #10287
  • Loading branch information
johnleider committed Jan 21, 2020
1 parent 80b1568 commit 19bdb4c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/vuetify/src/components/VFileInput/VFileInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export default VTextField.extend({
default: 'file',
},
value: {
default: () => [],
default: undefined,
validator: val => {
return typeof val === 'object' || Array.isArray(val)
},
Expand Down Expand Up @@ -154,7 +154,7 @@ export default VTextField.extend({

methods: {
clearableCallback () {
this.internalValue = this.isMultiple ? [] : null
this.internalValue = this.isMultiple ? [] : undefined
this.$refs.input.value = ''
},
genChips () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ describe('VFileInput.ts', () => {
})

wrapper.vm.clearableCallback()
expect(wrapper.vm.internalValue).toBeNull()
expect(wrapper.vm.internalValue).toBeUndefined()

const wrapper2 = mountFunction({
attrs: { multiple: '' },
Expand Down

0 comments on commit 19bdb4c

Please sign in to comment.