2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00
Files
vue-select/tests/helpers.js
T
2019-02-10 14:38:30 -08:00

29 lines
674 B
JavaScript
Executable File

import { shallowMount } from "@vue/test-utils";
import VueSelect from "../src/components/Select";
/**
* Trigger a submit event on the search
* input with a provided search text.
*
* @param Wrapper {Wrapper<Vue>}
* @param searchText
*/
export const searchSubmit = (Wrapper, searchText = false) => {
if (searchText) {
Wrapper.vm.search = searchText;
}
Wrapper.find({ ref: "search" }).trigger("keydown", {
keyCode: 13
});
};
/**
* Create a new VueSelect instance with
* a provided set of props.
* @param propsData
* @returns {Wrapper<Vue>}
*/
export const selectWithProps = (propsData = {}) => {
return shallowMount(VueSelect, { propsData });
};