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

remove stray coverage file

This commit is contained in:
Jeff Sagal
2016-07-11 16:21:35 -07:00
2 changed files with 60 additions and 2 deletions
+11 -2
View File
@@ -383,7 +383,16 @@
}
return newOption
}
}
},
/**
* When false, updating the options will not reset the select value
* @type {Boolean}
*/
resetOnOptionsChange: {
type: Boolean,
default: true
},
},
data() {
@@ -402,7 +411,7 @@
}
},
options() {
if (!this.taggable) {
if (!this.taggable && this.resetOnOptionsChange) {
this.$set('value', this.multiple ? [] : null)
}
},
+49
View File
@@ -752,6 +752,21 @@ describe('Select.vue', () => {
})
})
})
it('should not reset the selected value when the options property changes', (done) => {
const vm = new Vue({
template: '<div><v-select :options="options" :value.sync="value" :multiple="true" taggable></v-select></div>',
components: {vSelect},
data: {
value: [{label: 'one'}],
options: [{label: 'one'}]
}
}).$mount()
vm.$children[0].options = [{label: 'two'}]
Vue.nextTick(() => {
expect(vm.$children[0].value).toEqual([{label: 'one'}])
done()
})
})
})
describe('Asynchronous Loading', () => {
@@ -839,4 +854,38 @@ describe('Select.vue', () => {
})
})
})
describe('Reset on options change', () => {
it('should not reset the selected value when the options property changes', (done) => {
const vm = new Vue({
template: '<div><v-select :options="options" :value.sync="value" :reset-on-options-change="false"></v-select></div>',
components: {vSelect},
data: {
value: 'one',
options: ['one', 'two', 'three']
}
}).$mount()
vm.$children[0].options = ['four', 'five', 'six']
Vue.nextTick(() => {
expect(vm.$children[0].value).toEqual('one')
done()
})
})
it('should reset the selected value when the options property changes', (done) => {
const vm = new Vue({
template: '<div><v-select :options="options" :value.sync="value"></v-select></div>',
components: {vSelect},
data: {
value: 'one',
options: ['one', 'two', 'three']
}
}).$mount()
vm.$children[0].options = ['four', 'five', 'six']
Vue.nextTick(() => {
expect(vm.$children[0].value).toEqual(null)
done()
})
})
})
})