diff --git a/test/index.ts b/test/index.ts index 3db455b45..540f8ee38 100644 --- a/test/index.ts +++ b/test/index.ts @@ -1,3 +1,5 @@ +import './plugin'; + // promisify setTimeout export function later(delay = 0): Promise { return new Promise((resolve) => { diff --git a/test/plugin.ts b/test/plugin.ts new file mode 100644 index 000000000..c3a1241a1 --- /dev/null +++ b/test/plugin.ts @@ -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 { + style: CSSStyleDeclaration; + } + + // eslint-disable-next-line + class VueWrapper { + style: CSSStyleDeclaration; + } +} + +const stylePlugin = ( + wrapper: VueWrapper | DOMWrapper +) => { + return { + style: (wrapper.element as HTMLElement).style, + }; +}; + +config.plugins.DOMWrapper.install(stylePlugin); +config.plugins.VueWrapper.install(stylePlugin);