Skip to content

Commit

Permalink
fix: improvement functional component features (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
kahirokunn committed Feb 10, 2020
1 parent a4e077c commit ebcf97c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
5 changes: 3 additions & 2 deletions packages/server-test-utils/types/index.d.ts
@@ -1,4 +1,5 @@
import Vue, { VNodeData, ComponentOptions, FunctionalComponentOptions, Component } from 'vue'
import { DefaultProps, PropsDefinition } from 'vue/types/options'

/**
* Utility type to declare an extended Vue constructor
Expand Down Expand Up @@ -50,8 +51,8 @@ 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 (component: FunctionalComponentOptions, options?: MountOptions<Vue>): 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 (component: FunctionalComponentOptions, options?: MountOptions<Vue>): Promise<string>
export declare function renderToString<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(component: FunctionalComponentOptions<Props, PropDefs>, options?: MountOptions<Vue>): Promise<string>
11 changes: 6 additions & 5 deletions packages/test-utils/types/index.d.ts
@@ -1,4 +1,5 @@
import Vue, { VNodeData, ComponentOptions, FunctionalComponentOptions, Component } from 'vue'
import { DefaultProps, PropsDefinition } from 'vue/types/options'

/**
* Utility type to declare an extended Vue constructor
Expand Down Expand Up @@ -79,21 +80,21 @@ export interface Wrapper<V extends Vue | null> extends BaseWrapper {

get<R extends Vue> (selector: VueClass<R>): Wrapper<R>
get<R extends Vue> (selector: ComponentOptions<R>): Wrapper<R>
get (selector: FunctionalComponentOptions): Wrapper<Vue>
get<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): Wrapper<Vue>
get (selector: string): Wrapper<Vue>
get (selector: RefSelector): Wrapper<Vue>
get (selector: NameSelector): Wrapper<Vue>

find<R extends Vue> (selector: VueClass<R>): Wrapper<R>
find<R extends Vue> (selector: ComponentOptions<R>): Wrapper<R>
find (selector: FunctionalComponentOptions): Wrapper<Vue>
find<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): Wrapper<Vue>
find (selector: string): Wrapper<Vue>
find (selector: RefSelector): Wrapper<Vue>
find (selector: NameSelector): Wrapper<Vue>

findAll<R extends Vue> (selector: VueClass<R>): WrapperArray<R>
findAll<R extends Vue> (selector: ComponentOptions<R>): WrapperArray<R>
findAll (selector: FunctionalComponentOptions): WrapperArray<Vue>
findAll<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(selector: FunctionalComponentOptions<Props, PropDefs>): WrapperArray<Vue>
findAll (selector: string): WrapperArray<Vue>
findAll (selector: RefSelector): WrapperArray<Vue>
findAll (selector: NameSelector): WrapperArray<Vue>
Expand Down Expand Up @@ -157,11 +158,11 @@ export declare let config: VueTestUtilsConfigOptions

export declare function mount<V extends Vue> (component: VueClass<V>, options?: ThisTypedMountOptions<V>): Wrapper<V>
export declare function mount<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedMountOptions<V>): Wrapper<V>
export declare function mount (component: FunctionalComponentOptions, options?: MountOptions<Vue>): Wrapper<Vue>
export declare function mount<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(component: FunctionalComponentOptions<Props, PropDefs>, options?: MountOptions<Vue>): Wrapper<Vue>

export declare function shallowMount<V extends Vue> (component: VueClass<V>, options?: ThisTypedShallowMountOptions<V>): Wrapper<V>
export declare function shallowMount<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedShallowMountOptions<V>): Wrapper<V>
export declare function shallowMount (component: FunctionalComponentOptions, options?: ShallowMountOptions<Vue>): Wrapper<Vue>
export declare function shallowMount<Props = DefaultProps, PropDefs = PropsDefinition<Props>>(component: FunctionalComponentOptions<Props, PropDefs>, options?: ShallowMountOptions<Vue>): Wrapper<Vue>

export declare function createWrapper(node: Vue, options?: WrapperOptions): Wrapper<Vue>
export declare function createWrapper(node: HTMLElement, options?: WrapperOptions): Wrapper<null>
Expand Down

0 comments on commit ebcf97c

Please sign in to comment.