Skip to content

Commit 8f20b34

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

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

Diff for: src/index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
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'
9+
import WrapperArray from './wrappers/wrapper-array'
710

811
export default {
912
createLocalVue,
13+
createWrapper,
14+
createWrapperArray,
1015
config,
1116
mount,
1217
shallow,
1318
TransitionStub,
14-
TransitionGroupStub
19+
TransitionGroupStub,
20+
WrapperArray
1521
}

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

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

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)