2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-20 03:09:36 +03:00
Files
vue-select/tests/unit/ReactiveOptions.spec.js
T

21 lines
793 B
JavaScript

import { shallowMount } from "@vue/test-utils";
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"] }
});
Select.vm.mutableOptions = ["four", "five", "six"];
expect(Select.vm.mutableValue).toEqual("one");
});
it("should reset the selected value when the options property changes", () => {
const Select = shallowMount(VueSelect, {
propsData: { resetOnOptionsChange: true, value: "one", options: ["one"] }
});
Select.vm.mutableOptions = ["four", "five", "six"];
expect(Select.vm.mutableValue).toEqual(null);
});
});