mirror of
https://github.com/youzan/vant.git
synced 2025-10-16 08:00:34 +00:00
[Test] optimize async cases (#1232)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import Vue from 'vue';
|
||||
import { TransitionStub } from '@vue/test-utils';
|
||||
|
||||
// Trigger pointer/touch event
|
||||
export function trigger(wrapper, eventName, x = 0, y = 0) {
|
||||
const el = wrapper.element ? wrapper.element : wrapper;
|
||||
@@ -34,3 +37,14 @@ export function triggerDrag(el, x = 0, y = 0) {
|
||||
trigger(el, 'touchmove', x, y);
|
||||
trigger(el, 'touchend', x, y);
|
||||
}
|
||||
|
||||
// promisify setTimeout
|
||||
export function later(delay) {
|
||||
return new Promise(function(resolve) {
|
||||
setTimeout(resolve, delay);
|
||||
});
|
||||
}
|
||||
|
||||
export function transitionStub() {
|
||||
Vue.component('transition', TransitionStub);
|
||||
}
|
||||
|
Reference in New Issue
Block a user