Skip to content

Commit 284fbb9

Browse files
committed
feat: export createWrapper and add createWrapperArray functions
1 parent 0874d44 commit 284fbb9

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

Diff for: src/index.js

+4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import shallow from './shallow'
22
import mount from './mount'
33
import createLocalVue from './create-local-vue'
4+
import createWrapper from './wrappers/create-wrapper'
5+
import createWrapperArray from './wrappers/create-wrapper-array'
46
import TransitionStub from './components/TransitionStub'
57
import TransitionGroupStub from './components/TransitionGroupStub'
68
import config from './config'
79

810
export default {
911
createLocalVue,
12+
createWrapper,
13+
createWrapperArray,
1014
config,
1115
mount,
1216
shallow,

Diff for: src/wrappers/create-wrapper-array.js

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @flow
2+
3+
import WrapperArray from './wrapper-array'
4+
import type Wrapper from './wrapper'
5+
import type VueWrapper from './vue-wrapper'
6+
7+
export default function createWrapperArray (wrappers: Array<Wrapper | VueWrapper>) {
8+
return new WrapperArray(wrappers)
9+
}

Diff for: types/index.d.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Vue, { VNodeData, ComponentOptions, FunctionalComponentOptions } from 'vue'
1+
import Vue, { VNode, VNodeData, ComponentOptions, FunctionalComponentOptions } from 'vue'
22

33
// TODO: use core repo's Component type after https://github.com/vuejs/vue/pull/7369 is released
44
export type Component =
@@ -126,6 +126,8 @@ interface VueTestUtilsConfigOptions {
126126
}
127127

128128
export declare function createLocalVue (): typeof Vue
129+
export declare function createWrapper (node: VNode | Component, update?: Function, options?: WrapperOptions): Wrapper<Vue>
130+
export declare function createWrapperArray<T extends Vue> (wrappers: Array<Wrapper<T>>): WrapperArray<T>
129131
export declare let config: VueTestUtilsConfigOptions
130132

131133
export declare function mount<V extends Vue> (component: VueClass<V>, options?: ThisTypedMountOptions<V>): Wrapper<V>

0 commit comments

Comments
 (0)