2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-22 10:30:34 +03:00

fix isValueEmpty bug when working with integers

This commit is contained in:
Jeff
2018-01-28 17:54:25 -08:00
parent 79893024b5
commit b92428101f
2 changed files with 17 additions and 4 deletions
+1 -1
View File
@@ -1082,7 +1082,7 @@
if (typeof this.mutableValue === 'object') { if (typeof this.mutableValue === 'object') {
return ! Object.keys(this.mutableValue).length return ! Object.keys(this.mutableValue).length
} }
return !this.mutableValue.length return ! this.valueAsArray.length
} }
return true; return true;
+13
View File
@@ -249,6 +249,19 @@ describe('Select.vue', () => {
expect(vm.$children[0].isOptionSelected('foo')).toEqual(true) expect(vm.$children[0].isOptionSelected('foo')).toEqual(true)
}), }),
it('can work with an array of integers', () => {
const vm = new Vue({
template: '<div><v-select :options="[1,2,3,4,5]" v-model="value"></v-select></div>',
components: {vSelect},
data: {
value: 5,
}
}).$mount()
expect(vm.$children[0].isOptionSelected(5)).toEqual(true)
expect(vm.$children[0].isValueEmpty).toEqual(false)
})
describe('change Event', () => { describe('change Event', () => {
it('will trigger the input event when the selection changes', (done) => { it('will trigger the input event when the selection changes', (done) => {
const vm = new Vue({ const vm = new Vue({