mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-19 09:50:33 +03:00
add Jest suite from vue-cli-3 branch
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
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 });
|
||||
};
|
||||
Reference in New Issue
Block a user