2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-16 09:10: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:
Owen Conti
2019-03-23 12:25:31 -06:00
committed by Jeff Sagal
parent f95b118edb
commit f9725919a4
16 changed files with 250 additions and 1950 deletions
+7 -8
View File
@@ -10,7 +10,7 @@ describe("When index prop is defined", () => {
options: [{ label: "This is Foo", value: "foo" }]
}
});
expect(Select.vm.mutableValue).toEqual("foo");
expect(Select.vm.selectedValue).toEqual(["foo"]);
});
it("can determine if an object is pre-selected", () => {
@@ -66,7 +66,7 @@ describe("When index prop is defined", () => {
}
});
expect(Select.vm.mutableValue).toEqual(["foo", "bar"]);
expect(Select.vm.selectedValue).toEqual(["foo", "bar"]);
});
it("can deselect a pre-selected object", () => {
@@ -74,7 +74,6 @@ describe("When index prop is defined", () => {
propsData: {
multiple: true,
index: "value",
value: ["foo", "bar"],
options: [
{ label: "This is Foo", value: "foo" },
{ label: "This is Bar", value: "bar" }
@@ -82,16 +81,16 @@ describe("When index prop is defined", () => {
}
});
Select.vm.$data._value = ['foo', 'bar'];
Select.vm.deselect("foo");
expect(Select.vm.mutableValue.length).toEqual(1);
expect(Select.vm.mutableValue).toEqual(["bar"]);
expect(Select.vm.selectedValue).toEqual(["bar"]);
});
it("can deselect an option when multiple is false", () => {
const Select = shallowMount(VueSelect, {
propsData: {
index: "value",
value: "foo",
options: [
{ label: "This is Foo", value: "foo" },
{ label: "This is Bar", value: "bar" }
@@ -100,7 +99,7 @@ describe("When index prop is defined", () => {
});
Select.vm.deselect("foo");
expect(Select.vm.mutableValue).toEqual(null);
expect(Select.vm.selectedValue).toEqual([]);
});
it("can use v-model syntax for a two way binding to a parent component", () => {
@@ -120,7 +119,7 @@ describe("When index prop is defined", () => {
const Select = Parent.vm.$children[0];
expect(Select.value).toEqual("foo");
expect(Select.mutableValue).toEqual("foo");
expect(Select.selectedValue).toEqual(["foo"]);
Select.select({ label: "This is Bar", value: "bar" });
expect(Parent.vm.value).toEqual("bar");