mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test: add vtu style plugin (#8132)
This commit is contained in:
parent
a41b2c03bd
commit
58cb5b6d6b
@ -1,3 +1,5 @@
|
|||||||
|
import './plugin';
|
||||||
|
|
||||||
// promisify setTimeout
|
// promisify setTimeout
|
||||||
export function later(delay = 0): Promise<void> {
|
export function later(delay = 0): Promise<void> {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
|
26
test/plugin.ts
Normal file
26
test/plugin.ts
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/* eslint-disable max-classes-per-file */
|
||||||
|
import { ComponentPublicInstance } from 'vue';
|
||||||
|
import { config, VueWrapper, DOMWrapper } from '@vue/test-utils';
|
||||||
|
|
||||||
|
declare module '@vue/test-utils' {
|
||||||
|
// eslint-disable-next-line
|
||||||
|
export class DOMWrapper<ElementType extends Element> {
|
||||||
|
style: CSSStyleDeclaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
// eslint-disable-next-line
|
||||||
|
class VueWrapper<T extends ComponentPublicInstance> {
|
||||||
|
style: CSSStyleDeclaration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const stylePlugin = (
|
||||||
|
wrapper: VueWrapper<ComponentPublicInstance> | DOMWrapper<Element>
|
||||||
|
) => {
|
||||||
|
return {
|
||||||
|
style: (wrapper.element as HTMLElement).style,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config.plugins.DOMWrapper.install(stylePlugin);
|
||||||
|
config.plugins.VueWrapper.install(stylePlugin);
|
Loading…
x
Reference in New Issue
Block a user