mirror of
https://github.com/tenrok/vue-select.git
synced 2026-05-17 02:29:37 +03:00
29 lines
678 B
JavaScript
Executable File
29 lines
678 B
JavaScript
Executable File
import { shallowMount } from "@vue/test-utils";
|
|
import VueSelect from "../src/components/Select.vue";
|
|
|
|
/**
|
|
* 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 });
|
|
};
|