mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-22 10:30:34 +03:00
resetOnOptionsChange true by default, remove redundant test
This commit is contained in:
@@ -391,7 +391,7 @@
|
|||||||
*/
|
*/
|
||||||
resetOnOptionsChange: {
|
resetOnOptionsChange: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: false
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -125,22 +125,6 @@ describe('Select.vue', () => {
|
|||||||
expect(select.isValueEmpty).toEqual(true)
|
expect(select.isValueEmpty).toEqual(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should reset the selected values when the options property changes', (done) => {
|
|
||||||
const vm = new Vue({
|
|
||||||
template: '<div><v-select :options="options" :value.sync="value" :multiple="true"></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([])
|
|
||||||
done()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should reset the selected values when the multiple property changes', (done) => {
|
it('should reset the selected values when the multiple property changes', (done) => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><v-select :options="options" :value.sync="value" :multiple="multiple"></v-select></div>',
|
template: '<div><v-select :options="options" :value.sync="value" :multiple="multiple"></v-select></div>',
|
||||||
@@ -856,10 +840,9 @@ describe('Select.vue', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('Reset on options change', () => {
|
describe('Reset on options change', () => {
|
||||||
it('should not reset the selected value when the options property changes', (done) => {
|
it('should not reset the selected value by default when the options property changes', (done) => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><v-select :options="options" :value.sync="value" :reset-on-options-change="false"></v-select></div>',
|
template: '<div><v-select :options="options" :value.sync="value"></v-select></div>',
|
||||||
components: {vSelect},
|
|
||||||
data: {
|
data: {
|
||||||
value: 'one',
|
value: 'one',
|
||||||
options: ['one', 'two', 'three']
|
options: ['one', 'two', 'three']
|
||||||
@@ -874,7 +857,7 @@ describe('Select.vue', () => {
|
|||||||
|
|
||||||
it('should reset the selected value when the options property changes', (done) => {
|
it('should reset the selected value when the options property changes', (done) => {
|
||||||
const vm = new Vue({
|
const vm = new Vue({
|
||||||
template: '<div><v-select :options="options" :value.sync="value"></v-select></div>',
|
template: '<div><v-select :options="options" :value.sync="value" reset-on-options-change></v-select></div>',
|
||||||
components: {vSelect},
|
components: {vSelect},
|
||||||
data: {
|
data: {
|
||||||
value: 'one',
|
value: 'one',
|
||||||
|
|||||||
Reference in New Issue
Block a user