mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-19 09:50:33 +03:00
V3 - Remove mutable class properties plus other misc changes (#781)
* Remove the mutableValue prop in the Select component. * Add back mutable value when Vue Select has to manage its own value. * Remove mutableOptions, valueAsAarray. Update webpack minifer to use Terser. * Fix tabbing * Fix bug with showClearButton * Fix tests. * Call clearSelection when possible * Update dev sandbox to have all three options for setting value. * Update dev sandbox to display current value * Remove unused karma test setup. * Revert onInput name change. * Use coveralls * Change this.internalValue to this.$data._value. * Remove onInput prop and replace with internal method, updateValue. * Update tests. * Rename optionObjectComparator to optionComparator.
This commit is contained in:
@@ -4,17 +4,23 @@ import VueSelect from "../../src/components/Select";
|
||||
describe("Reset on options change", () => {
|
||||
it("should not reset the selected value by default when the options property changes", () => {
|
||||
const Select = shallowMount(VueSelect, {
|
||||
propsData: { value: "one", options: ["one"] }
|
||||
propsData: { options: ["one"] }
|
||||
});
|
||||
Select.vm.mutableOptions = ["four", "five", "six"];
|
||||
expect(Select.vm.mutableValue).toEqual("one");
|
||||
|
||||
Select.vm.$data._value = 'one';
|
||||
|
||||
Select.setProps({options: ["four", "five", "six"]});
|
||||
expect(Select.vm.selectedValue).toEqual(["one"]);
|
||||
});
|
||||
|
||||
it("should reset the selected value when the options property changes", () => {
|
||||
const Select = shallowMount(VueSelect, {
|
||||
propsData: { resetOnOptionsChange: true, value: "one", options: ["one"] }
|
||||
propsData: { resetOnOptionsChange: true, options: ["one"] }
|
||||
});
|
||||
Select.vm.mutableOptions = ["four", "five", "six"];
|
||||
expect(Select.vm.mutableValue).toEqual(null);
|
||||
|
||||
Select.vm.$data._value = 'one';
|
||||
|
||||
Select.setProps({options: ["four", "five", "six"]});
|
||||
expect(Select.vm.selectedValue).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user