mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
added regression test to make sure tags are removed when close is clicked, commit 48dbade broke that functionality
This commit is contained in:
Vendored
+3
-3
@@ -10338,9 +10338,9 @@ exports.default = {
|
|||||||
this.value = option;
|
this.value = option;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if (this.multiple) {
|
if (this.multiple) {
|
||||||
// this.value.$remove(option)
|
this.value.$remove(option);
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.multiple) {
|
if (!this.multiple) {
|
||||||
|
|||||||
@@ -221,9 +221,9 @@
|
|||||||
this.value = option
|
this.value = option
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if (this.multiple) {
|
if (this.multiple) {
|
||||||
// this.value.$remove(option)
|
this.value.$remove(option)
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.multiple) {
|
if (!this.multiple) {
|
||||||
|
|||||||
@@ -66,6 +66,24 @@ describe('Select.vue', () => {
|
|||||||
expect( labels ).toEqual( ['This is Foo', 'This is Bar'] )
|
expect( labels ).toEqual( ['This is Foo', 'This is Bar'] )
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('removes the given tag when its close icon is clicked', (done) => {
|
||||||
|
const vm = new Vue({
|
||||||
|
template: '<div><v-select :value.sync="value" :multiple="true"></v-select></div>',
|
||||||
|
components: { vSelect },
|
||||||
|
data: {
|
||||||
|
value: ['one'],
|
||||||
|
options: ['one','two','three']
|
||||||
|
}
|
||||||
|
}).$mount()
|
||||||
|
|
||||||
|
vm.$children[0].$els.toggle.querySelector('.close').click()
|
||||||
|
|
||||||
|
Vue.nextTick(() => {
|
||||||
|
expect(vm.$children[0].$get('value')).toEqual([])
|
||||||
|
done()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
it('removes the last item in the value array on delete keypress when multiple is true', () => {
|
it('removes the last item in the value array on delete keypress when multiple is true', () => {
|
||||||
|
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
|
|||||||
Reference in New Issue
Block a user