forked from vuejs/vue-test-utils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.d.ts
59 lines (48 loc) · 2.29 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import Vue, { VNodeData, ComponentOptions, FunctionalComponentOptions, Component } from 'vue'
import { DefaultProps, PropsDefinition } from 'vue/types/options'
import * as Cheerio from 'cheerio'
/**
* Utility type to declare an extended Vue constructor
*/
type VueClass<V extends Vue> = (new (...args: any[]) => V) & typeof Vue
/**
* Utility type for stubs which can be a string of template as a shorthand
* If it is an array of string, the specified children are replaced by blank components
*/
type Stubs = {
[key: string]: Component | string | boolean
} | string[]
/**
* Utility type for slots
*/
type Slots = {
[key: string]: (Component | string)[] | Component | string
}
interface MountOptions<V extends Vue> extends ComponentOptions<V> {
attachToDocument?: boolean
context?: VNodeData
localVue?: typeof Vue
mocks?: object
slots?: Slots
scopedSlots?: Record<string, string>
stubs?: Stubs,
attrs?: Record<string, string>
listeners?: Record<string, Function | Function[]>
}
type ThisTypedMountOptions<V extends Vue> = MountOptions<V> & ThisType<V>
type ShallowOptions<V extends Vue> = MountOptions<V>
type ThisTypedShallowOptions<V extends Vue> = ShallowOptions<V> & ThisType<V>
interface VueTestUtilsConfigOptions {
stubs?: Stubs
mocks?: object
methods?: Record<string, Function>
provide?: object,
silent?: Boolean
}
export declare let config: VueTestUtilsConfigOptions
export declare function render<V extends Vue> (component: VueClass<V>, options?: ThisTypedMountOptions<V>): Promise<Cheerio>
export declare function render<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedMountOptions<V>): Promise<Cheerio>
export declare function render<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(component: FunctionalComponentOptions<Props, PropDefs>, options?: MountOptions<Vue>): Promise<Cheerio>
export declare function renderToString<V extends Vue> (component: VueClass<V>, options?: ThisTypedMountOptions<V>): Promise<string>
export declare function renderToString<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedMountOptions<V>): Promise<string>
export declare function renderToString<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(component: FunctionalComponentOptions<Props, PropDefs>, options?: MountOptions<Vue>): Promise<string>