2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-10 07:52:23 +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
+2 -2
View File
@@ -1080,9 +1080,9 @@
isValueEmpty() {
if (this.mutableValue) {
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;
+15 -2
View File
@@ -249,7 +249,20 @@ describe('Select.vue', () => {
expect(vm.$children[0].isOptionSelected('foo')).toEqual(true)
}),
describe('change Event', () => {
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', () => {
it('will trigger the input event when the selection changes', (done) => {
const vm = new Vue({
template: `<div><v-select ref="select" :value="['foo']" :options="['foo','bar','baz']" v-on:input="foo = arguments[0]"></v-select></div>`,
@@ -1564,7 +1577,7 @@ describe('Select.vue', () => {
})
})
describe( 'Clear button', () => {
describe('Clear button', () => {
it( 'should be displayed on single select when value is selected', () => {
const VueSelect = Vue.extend( vSelect )