diff --git a/src/components/Select.vue b/src/components/Select.vue index a04cfb3..e6ce97c 100644 --- a/src/components/Select.vue +++ b/src/components/Select.vue @@ -702,7 +702,7 @@ export default { value = this.$data._value } - if (value) { + if (value !== undefined && value !== null) { return [].concat(value) } diff --git a/tests/unit/Selecting.spec.js b/tests/unit/Selecting.spec.js index 7e407ad..67301f9 100755 --- a/tests/unit/Selecting.spec.js +++ b/tests/unit/Selecting.spec.js @@ -213,6 +213,23 @@ describe('VS - Selecting Values', () => { expect(Select.vm.selectedValue).toEqual(options) }) + fit('can select a false boolean option', async () => { + const Select = mountDefault({ + options: [false], + }) + + expect(Select.vm.isOptionSelected(false)).toBeFalsy() + expect(Select.vm.optionExists(false)).toBeTruthy() + + Select.vm.open = true + await Select.vm.$nextTick() + + Select.find('.vs__dropdown-option').trigger('click') + await Select.vm.$nextTick() + + expect(Select.vm.selectedValue).toEqual([false]) + }) + describe('input Event', () => { it('will trigger the input event when the selection changes', () => { const Select = shallowMount(VueSelect)