mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
never deselect options from the dropdown
This commit is contained in:
@@ -759,9 +759,7 @@
|
|||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
select(option) {
|
select(option) {
|
||||||
if (this.isOptionSelected(option)) {
|
if (!this.isOptionSelected(option)) {
|
||||||
this.deselect(option)
|
|
||||||
} else {
|
|
||||||
if (this.taggable && !this.optionExists(option)) {
|
if (this.taggable && !this.optionExists(option)) {
|
||||||
option = this.createOption(option)
|
option = this.createOption(option)
|
||||||
}
|
}
|
||||||
@@ -802,9 +800,9 @@
|
|||||||
* Clears the currently selected value(s)
|
* Clears the currently selected value(s)
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
clearSelection() {
|
clearSelection() {
|
||||||
this.mutableValue = this.multiple ? [] : null
|
this.mutableValue = this.multiple ? [] : null
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called from this.select after each selection.
|
* Called from this.select after each selection.
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ describe('Select.vue', () => {
|
|||||||
options: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}]
|
options: [{label: 'This is Foo', value: 'foo'}, {label: 'This is Bar', value: 'bar'}]
|
||||||
}
|
}
|
||||||
}).$mount()
|
}).$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)
|
expect(vm.$children[0].mutableValue.length).toEqual(1)
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -129,7 +129,7 @@ describe('Select.vue', () => {
|
|||||||
options: ['foo','bar']
|
options: ['foo','bar']
|
||||||
}
|
}
|
||||||
}).$mount()
|
}).$mount()
|
||||||
vm.$children[0].select('foo')
|
vm.$children[0].deselect('foo')
|
||||||
expect(vm.$children[0].mutableValue.length).toEqual(1)
|
expect(vm.$children[0].mutableValue.length).toEqual(1)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@@ -1090,7 +1090,7 @@ describe('Select.vue', () => {
|
|||||||
vm.$refs.select.search = 'one'
|
vm.$refs.select.search = 'one'
|
||||||
searchSubmit(vm)
|
searchSubmit(vm)
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
expect(vm.$refs.select.mutableValue).toEqual([])
|
expect(vm.$refs.select.mutableValue).toEqual(['one'])
|
||||||
expect(vm.$refs.select.search).toEqual('')
|
expect(vm.$refs.select.search).toEqual('')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
@@ -1109,7 +1109,7 @@ describe('Select.vue', () => {
|
|||||||
vm.$refs.select.search = 'one'
|
vm.$refs.select.search = 'one'
|
||||||
searchSubmit(vm)
|
searchSubmit(vm)
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
expect(vm.$refs.select.mutableValue).toEqual([])
|
expect(vm.$refs.select.mutableValue).toEqual(['one'])
|
||||||
expect(vm.$refs.select.search).toEqual('')
|
expect(vm.$refs.select.search).toEqual('')
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user