2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-06-19 09:50:33 +03:00

fix: create option not being called (#1158)

Closes #1156
This commit is contained in:
Jeff Sagal
2020-04-12 12:36:19 -07:00
committed by GitHub
parent 142a639444
commit f0e669c022
6 changed files with 88 additions and 35 deletions
+30
View File
@@ -0,0 +1,30 @@
import { searchSubmit, selectTag, selectWithProps } from "../helpers";
describe("CreateOption When Tagging Is Enabled", () => {
it("can select the current search text as a string", async () => {
const Select = selectWithProps({
taggable: true,
multiple: true,
options: ["one", "two"],
createOption: option => "four"
});
await selectTag(Select, "three");
expect(Select.vm.selectedValue).toEqual(["four"]);
});
it("can select the current search text as an object", async () => {
const Select = selectWithProps({
taggable: true,
multiple: false,
value: null,
options: [],
label: "name",
createOption: title => ({ name: title })
});
await selectTag(Select, "two");
expect(Select.emitted("input")[0]).toEqual([{ name: "two" }]);
});
});