2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-04 06:32:23 +03:00

never deselect options from the dropdown

This commit is contained in:
Jeff
2018-01-23 08:48:23 -08:00
parent 22d2004e2f
commit b3a551c836
2 changed files with 8 additions and 10 deletions
+4 -6
View File
@@ -759,9 +759,7 @@
* @return {void}
*/
select(option) {
if (this.isOptionSelected(option)) {
this.deselect(option)
} else {
if (!this.isOptionSelected(option)) {
if (this.taggable && !this.optionExists(option)) {
option = this.createOption(option)
}
@@ -802,9 +800,9 @@
* Clears the currently selected value(s)
* @return {void}
*/
clearSelection() {
this.mutableValue = this.multiple ? [] : null
},
clearSelection() {
this.mutableValue = this.multiple ? [] : null
},
/**
* Called from this.select after each selection.
+4 -4
View File
@@ -117,7 +117,7 @@ describe('Select.vue', () => {
options: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}]
}
}).$mount()
vm.$children[0].select({label: 'This is Foo', value: 'foo'})
vm.$children[0].deselect({label: 'This is Foo', value: 'foo'})
expect(vm.$children[0].mutableValue.length).toEqual(1)
})
@@ -129,7 +129,7 @@ describe('Select.vue', () => {
options: ['foo','bar']
}
}).$mount()
vm.$children[0].select('foo')
vm.$children[0].deselect('foo')
expect(vm.$children[0].mutableValue.length).toEqual(1)
}),
@@ -1090,7 +1090,7 @@ describe('Select.vue', () => {
vm.$refs.select.search = 'one'
searchSubmit(vm)
Vue.nextTick(() => {
expect(vm.$refs.select.mutableValue).toEqual([])
expect(vm.$refs.select.mutableValue).toEqual(['one'])
expect(vm.$refs.select.search).toEqual('')
done()
})
@@ -1109,7 +1109,7 @@ describe('Select.vue', () => {
vm.$refs.select.search = 'one'
searchSubmit(vm)
Vue.nextTick(() => {
expect(vm.$refs.select.mutableValue).toEqual([])
expect(vm.$refs.select.mutableValue).toEqual(['one'])
expect(vm.$refs.select.search).toEqual('')
done()
})