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:
@@ -1080,9 +1080,9 @@
|
|||||||
isValueEmpty() {
|
isValueEmpty() {
|
||||||
if (this.mutableValue) {
|
if (this.mutableValue) {
|
||||||
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;
|
||||||
|
|||||||
@@ -249,7 +249,20 @@ describe('Select.vue', () => {
|
|||||||
expect(vm.$children[0].isOptionSelected('foo')).toEqual(true)
|
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) => {
|
it('will trigger the input event when the selection changes', (done) => {
|
||||||
const vm = new Vue({
|
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>`,
|
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', () => {
|
it( 'should be displayed on single select when value is selected', () => {
|
||||||
const VueSelect = Vue.extend( vSelect )
|
const VueSelect = Vue.extend( vSelect )
|
||||||
|
|||||||
Reference in New Issue
Block a user