2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-23 03:54:04 +03:00
Files
vue-select/tests/helpers.js
T
Jeff eed25d7a5a - migrate tagging spec
- add helpers
2018-08-12 12:33:13 -07:00

29 lines
674 B
JavaScript

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 });
};