cypress 10.2.0 → 10.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/exec/open.js +7 -2
- package/lib/exec/spawn.js +7 -2
- package/mount-utils/CHANGELOG.md +0 -1
- package/mount-utils/README.md +7 -0
- package/mount-utils/dist/index.js +8 -1
- package/mount-utils/package.json +1 -0
- package/package.json +20 -10
- package/react/CHANGELOG.md +0 -19
- package/react/README.md +28 -323
- package/react/dist/createMount.d.ts +30 -0
- package/react/dist/cypress-react.cjs.js +76 -80
- package/react/dist/cypress-react.esm-bundler.js +68 -76
- package/react/dist/getDisplayName.d.ts +1 -1
- package/react/dist/index.d.ts +2 -0
- package/react/dist/mount.d.ts +5 -141
- package/react/dist/types.d.ts +50 -0
- package/react/package.json +1 -5
- package/react18/dist/cypress-react.cjs.js +422 -0
- package/react18/dist/cypress-react.esm-bundler.js +394 -0
- package/react18/dist/index.d.ts +5 -0
- package/react18/package.json +59 -0
- package/types/cypress.d.ts +11 -2
- package/types/index.d.ts +1 -1
- package/types/{net-stubbing.ts → net-stubbing.d.ts} +0 -0
- package/vue/CHANGELOG.md +2 -17
- package/vue/README.md +17 -607
- package/vue/dist/@vue/test-utils/baseWrapper.d.ts +63 -0
- package/vue/dist/@vue/test-utils/components/RouterLinkStub.d.ts +21 -0
- package/vue/dist/@vue/test-utils/config.d.ts +30 -0
- package/vue/dist/@vue/test-utils/constants/dom-events.d.ts +900 -0
- package/vue/dist/@vue/test-utils/createDomEvent.d.ts +9 -0
- package/vue/dist/@vue/test-utils/domWrapper.d.ts +18 -0
- package/vue/dist/@vue/test-utils/emit.d.ts +5 -0
- package/vue/dist/@vue/test-utils/errorWrapper.d.ts +1 -0
- package/vue/dist/@vue/test-utils/index.d.ts +11 -0
- package/vue/dist/@vue/test-utils/interfaces/wrapperLike.d.ts +56 -0
- package/vue/dist/@vue/test-utils/mount.d.ts +35 -0
- package/vue/dist/@vue/test-utils/stubs.d.ts +22 -0
- package/vue/dist/@vue/test-utils/types.d.ts +125 -0
- package/vue/dist/@vue/test-utils/utils/autoUnmount.d.ts +5 -0
- package/vue/dist/@vue/test-utils/utils/compileSlots.d.ts +2 -0
- package/vue/dist/@vue/test-utils/utils/componentName.d.ts +4 -0
- package/vue/dist/@vue/test-utils/utils/find.d.ts +10 -0
- package/vue/dist/@vue/test-utils/utils/flushPromises.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/getRootNodes.d.ts +2 -0
- package/vue/dist/@vue/test-utils/utils/isElement.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/isElementVisible.d.ts +6 -0
- package/vue/dist/@vue/test-utils/utils/matchName.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/stringifyNode.d.ts +1 -0
- package/vue/dist/@vue/test-utils/utils/vueCompatSupport.d.ts +8 -0
- package/vue/dist/@vue/test-utils/utils/vueShared.d.ts +3 -0
- package/vue/dist/@vue/test-utils/utils.d.ts +13 -0
- package/vue/dist/@vue/test-utils/vueWrapper.d.ts +35 -0
- package/vue/dist/@vue/test-utils/wrapperFactory.d.ts +14 -0
- package/vue/dist/cypress-vue.cjs.js +5583 -5209
- package/vue/dist/cypress-vue.esm-bundler.js +5584 -5211
- package/vue/dist/index.d.ts +35 -3
- package/vue/package.json +11 -7
- package/vue2/README.md +11 -627
- package/vue2/dist/cypress-vue2.browser.js +268 -262
- package/vue2/dist/cypress-vue2.cjs.js +267 -261
- package/vue2/dist/cypress-vue2.esm-bundler.js +265 -259
- package/vue2/package.json +1 -1
- package/react/dist/cypress-react.browser.js +0 -497
@@ -0,0 +1,9 @@
|
|
1
|
+
import { DomEventNameWithModifier, KeyName, keyCodesByKeyName } from './constants/dom-events';
|
2
|
+
interface TriggerOptions {
|
3
|
+
code?: String;
|
4
|
+
key?: String;
|
5
|
+
keyCode?: Number;
|
6
|
+
[custom: string]: any;
|
7
|
+
}
|
8
|
+
declare function createDOMEvent(eventString: DomEventNameWithModifier | string, options?: TriggerOptions): Event & TriggerOptions;
|
9
|
+
export { TriggerOptions, createDOMEvent, keyCodesByKeyName, KeyName };
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import BaseWrapper from './baseWrapper';
|
2
|
+
import { RefSelector } from './types';
|
3
|
+
export declare class DOMWrapper<NodeType extends Node> extends BaseWrapper<NodeType> {
|
4
|
+
constructor(element: NodeType);
|
5
|
+
getRootNodes(): import("./types").VueNode<NodeType>[];
|
6
|
+
getCurrentComponent(): import("vue").ComponentInternalInstance | undefined;
|
7
|
+
find<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>;
|
8
|
+
find<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>;
|
9
|
+
find<T extends Element = Element>(selector: string): DOMWrapper<T>;
|
10
|
+
find<T extends Node = Node>(selector: string | RefSelector): DOMWrapper<T>;
|
11
|
+
findAll<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>[];
|
12
|
+
findAll<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>[];
|
13
|
+
findAll<T extends Element>(selector: string): DOMWrapper<T>[];
|
14
|
+
findAllComponents(selector: any): any;
|
15
|
+
private setChecked;
|
16
|
+
setValue(value?: any): Promise<void>;
|
17
|
+
private setSelected;
|
18
|
+
}
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { ComponentPublicInstance, ComponentInternalInstance } from 'vue';
|
2
|
+
export declare function emitted<T = unknown>(vm: ComponentPublicInstance, eventName?: string): undefined | T[] | Record<string, T[]>;
|
3
|
+
export declare const attachEmitListener: () => void;
|
4
|
+
export declare const recordEvent: (vm: ComponentInternalInstance, event: string, args: unknown[]) => void;
|
5
|
+
export declare const removeEventHistory: (vm: ComponentPublicInstance) => void;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function createWrapperError<T extends object>(wrapperType: 'DOMWrapper' | 'VueWrapper'): T;
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { DOMWrapper } from './domWrapper';
|
2
|
+
import { VueWrapper } from './vueWrapper';
|
3
|
+
import BaseWrapper from './baseWrapper';
|
4
|
+
import { mount, shallowMount } from './mount';
|
5
|
+
import { MountingOptions } from './types';
|
6
|
+
import { RouterLinkStub } from './components/RouterLinkStub';
|
7
|
+
import { createWrapperError } from './errorWrapper';
|
8
|
+
import { config } from './config';
|
9
|
+
import { flushPromises } from './utils/flushPromises';
|
10
|
+
import { enableAutoUnmount, disableAutoUnmount } from './utils/autoUnmount';
|
11
|
+
export { mount, shallowMount, enableAutoUnmount, disableAutoUnmount, RouterLinkStub, VueWrapper, DOMWrapper, BaseWrapper, config, flushPromises, MountingOptions, createWrapperError };
|
@@ -0,0 +1,56 @@
|
|
1
|
+
import { DomEventNameWithModifier } from '../constants/dom-events';
|
2
|
+
import { TriggerOptions } from '../createDomEvent';
|
3
|
+
import { DefinedComponent, FindAllComponentsSelector, FindComponentSelector, NameSelector, RefSelector } from '../types';
|
4
|
+
import { VueWrapper } from '../vueWrapper';
|
5
|
+
import { ComponentPublicInstance, FunctionalComponent } from 'vue';
|
6
|
+
import type { DOMWrapper } from '../domWrapper';
|
7
|
+
export default interface WrapperLike {
|
8
|
+
readonly element: Node;
|
9
|
+
find<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>;
|
10
|
+
find<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>;
|
11
|
+
find<T extends Element = Element>(selector: string): DOMWrapper<T>;
|
12
|
+
find<T extends Node = Node>(selector: string | RefSelector): DOMWrapper<T>;
|
13
|
+
findAll<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>[];
|
14
|
+
findAll<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>[];
|
15
|
+
findAll<T extends Element>(selector: string): DOMWrapper<T>[];
|
16
|
+
findAll(selector: string): DOMWrapper<Element>[];
|
17
|
+
findComponent<T extends never>(selector: string): WrapperLike;
|
18
|
+
findComponent<T extends DefinedComponent>(selector: T | Exclude<FindComponentSelector, FunctionalComponent>): VueWrapper<InstanceType<T>>;
|
19
|
+
findComponent<T extends FunctionalComponent>(selector: T | string): DOMWrapper<Element>;
|
20
|
+
findComponent<T extends never>(selector: NameSelector | RefSelector): VueWrapper;
|
21
|
+
findComponent<T extends ComponentPublicInstance>(selector: T | FindComponentSelector): VueWrapper<T>;
|
22
|
+
findComponent(selector: FindComponentSelector): WrapperLike;
|
23
|
+
findAllComponents<T extends never>(selector: string): WrapperLike[];
|
24
|
+
findAllComponents<T extends DefinedComponent>(selector: T | Exclude<FindAllComponentsSelector, FunctionalComponent>): VueWrapper<InstanceType<T>>[];
|
25
|
+
findAllComponents<T extends FunctionalComponent>(selector: string): DOMWrapper<Element>[];
|
26
|
+
findAllComponents<T extends FunctionalComponent>(selector: T): DOMWrapper<Node>[];
|
27
|
+
findAllComponents<T extends never>(selector: NameSelector): VueWrapper[];
|
28
|
+
findAllComponents<T extends ComponentPublicInstance>(selector: T | FindAllComponentsSelector): VueWrapper<T>[];
|
29
|
+
findAllComponents(selector: FindAllComponentsSelector): WrapperLike[];
|
30
|
+
get<K extends keyof HTMLElementTagNameMap>(selector: K): Omit<DOMWrapper<HTMLElementTagNameMap[K]>, 'exists'>;
|
31
|
+
get<K extends keyof SVGElementTagNameMap>(selector: K): Omit<DOMWrapper<SVGElementTagNameMap[K]>, 'exists'>;
|
32
|
+
get<T extends Element = Element>(selector: string): Omit<DOMWrapper<T>, 'exists'>;
|
33
|
+
get<T extends Node = Node>(selector: string | RefSelector): Omit<DOMWrapper<T>, 'exists'>;
|
34
|
+
getComponent<T extends never>(selector: string): Omit<WrapperLike, 'exists'>;
|
35
|
+
getComponent<T extends DefinedComponent>(selector: T | Exclude<FindComponentSelector, FunctionalComponent>): Omit<VueWrapper<InstanceType<T>>, 'exists'>;
|
36
|
+
getComponent<T extends FunctionalComponent>(selector: T | string): Omit<DOMWrapper<Element>, 'exists'>;
|
37
|
+
getComponent<T extends ComponentPublicInstance>(selector: T | FindComponentSelector): Omit<VueWrapper<T>, 'exists'>;
|
38
|
+
getComponent<T extends never>(selector: FindComponentSelector): Omit<WrapperLike, 'exists'>;
|
39
|
+
html(): string;
|
40
|
+
classes(): string[];
|
41
|
+
classes(className: string): boolean;
|
42
|
+
classes(className?: string): string[] | boolean;
|
43
|
+
attributes(): {
|
44
|
+
[key: string]: string;
|
45
|
+
};
|
46
|
+
attributes(key: string): string | undefined;
|
47
|
+
attributes(key?: string): {
|
48
|
+
[key: string]: string;
|
49
|
+
} | string | undefined;
|
50
|
+
text(): string;
|
51
|
+
exists(): boolean;
|
52
|
+
setValue(value: any): Promise<void>;
|
53
|
+
isVisible(): boolean;
|
54
|
+
trigger(eventString: DomEventNameWithModifier, options?: TriggerOptions): Promise<void>;
|
55
|
+
trigger(eventString: string, options?: TriggerOptions): Promise<void>;
|
56
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { FunctionalComponent, ComponentPublicInstance, ComponentOptionsWithObjectProps, ComponentOptionsWithArrayProps, ComponentOptionsWithoutProps, ExtractPropTypes, VNodeProps, ComponentOptionsMixin, DefineComponent, MethodOptions, AllowedComponentProps, ComponentCustomProps, ExtractDefaultPropTypes, EmitsOptions, ComputedOptions, ComponentPropsOptions, Prop } from 'vue';
|
2
|
+
import { MountingOptions } from './types';
|
3
|
+
import { VueWrapper } from './vueWrapper';
|
4
|
+
declare type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
5
|
+
declare type ComponentMountingOptions<T> = T extends DefineComponent<infer PropsOrPropOptions, any, infer D, any, any> ? MountingOptions<Partial<ExtractDefaultPropTypes<PropsOrPropOptions>> & Omit<Readonly<ExtractPropTypes<PropsOrPropOptions>> & PublicProps, keyof ExtractDefaultPropTypes<PropsOrPropOptions>>, D> & Record<string, any> : MountingOptions<any>;
|
6
|
+
export declare function mount<V>(originalComponent: {
|
7
|
+
new (...args: any[]): V;
|
8
|
+
__vccOpts: any;
|
9
|
+
}, options?: MountingOptions<any> & Record<string, any>): VueWrapper<ComponentPublicInstance<V>>;
|
10
|
+
export declare function mount<V, P>(originalComponent: {
|
11
|
+
new (...args: any[]): V;
|
12
|
+
__vccOpts: any;
|
13
|
+
defaultProps?: Record<string, Prop<any>> | string[];
|
14
|
+
}, options?: MountingOptions<P & PublicProps> & Record<string, any>): VueWrapper<ComponentPublicInstance<V>>;
|
15
|
+
export declare function mount<V>(originalComponent: {
|
16
|
+
new (...args: any[]): V;
|
17
|
+
registerHooks(keys: string[]): void;
|
18
|
+
}, options?: MountingOptions<any> & Record<string, any>): VueWrapper<ComponentPublicInstance<V>>;
|
19
|
+
export declare function mount<V, P>(originalComponent: {
|
20
|
+
new (...args: any[]): V;
|
21
|
+
props(Props: P): any;
|
22
|
+
registerHooks(keys: string[]): void;
|
23
|
+
}, options?: MountingOptions<P & PublicProps> & Record<string, any>): VueWrapper<ComponentPublicInstance<V>>;
|
24
|
+
export declare function mount<Props, E extends EmitsOptions = {}>(originalComponent: FunctionalComponent<Props, E>, options?: MountingOptions<Props & PublicProps> & Record<string, any>): VueWrapper<ComponentPublicInstance<Props>>;
|
25
|
+
export declare function mount<PropsOrPropOptions = {}, RawBindings = {}, D = {}, C extends ComputedOptions = ComputedOptions, M extends MethodOptions = MethodOptions, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, E extends EmitsOptions = Record<string, any>, EE extends string = string, PP = PublicProps, Props = Readonly<ExtractPropTypes<PropsOrPropOptions>>, Defaults = ExtractDefaultPropTypes<PropsOrPropOptions>>(component: DefineComponent<PropsOrPropOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PP, Props, Defaults>, options?: MountingOptions<Partial<Defaults> & Omit<Props & PublicProps, keyof Defaults>, D> & Record<string, any>): VueWrapper<InstanceType<DefineComponent<PropsOrPropOptions, RawBindings, D, C, M, Mixin, Extends, E, EE, PP, Props, Defaults>>>;
|
26
|
+
export declare function mount<T extends DefineComponent<any, any, any, any>>(component: T, options?: ComponentMountingOptions<T>): VueWrapper<InstanceType<T>>;
|
27
|
+
export declare function mount<Props = {}, RawBindings = {}, D = {}, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string>(componentOptions: ComponentOptionsWithoutProps<Props, RawBindings, D, C, M, E, Mixin, Extends, EE>, options?: MountingOptions<Props & PublicProps, D>): VueWrapper<ComponentPublicInstance<Props, RawBindings, D, C, M, E, VNodeProps & Props>> & Record<string, any>;
|
28
|
+
export declare function mount<PropNames extends string, RawBindings, D, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string, Props extends Readonly<{
|
29
|
+
[key in PropNames]?: any;
|
30
|
+
}> = Readonly<{
|
31
|
+
[key in PropNames]?: any;
|
32
|
+
}>>(componentOptions: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, E, Mixin, Extends, EE, Props>, options?: MountingOptions<Props & PublicProps, D>): VueWrapper<ComponentPublicInstance<Props, RawBindings, D, C, M, E>>;
|
33
|
+
export declare function mount<PropsOptions extends Readonly<ComponentPropsOptions>, RawBindings, D, C extends ComputedOptions = {}, M extends Record<string, Function> = {}, E extends EmitsOptions = Record<string, any>, Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, Extends extends ComponentOptionsMixin = ComponentOptionsMixin, EE extends string = string>(componentOptions: ComponentOptionsWithObjectProps<PropsOptions, RawBindings, D, C, M, E, Mixin, Extends, EE>, options?: MountingOptions<ExtractPropTypes<PropsOptions> & PublicProps, D>): VueWrapper<ComponentPublicInstance<ExtractPropTypes<PropsOptions>, RawBindings, D, C, M, E, VNodeProps & ExtractPropTypes<PropsOptions>>>;
|
34
|
+
export declare const shallowMount: typeof mount;
|
35
|
+
export {};
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { VNodeTypes, ConcreteComponent, DefineComponent } from 'vue';
|
2
|
+
import { Stubs } from './types';
|
3
|
+
export declare type CustomCreateStub = (params: {
|
4
|
+
name: string;
|
5
|
+
component: ConcreteComponent;
|
6
|
+
}) => ConcreteComponent;
|
7
|
+
interface StubOptions {
|
8
|
+
name: string;
|
9
|
+
type?: ConcreteComponent;
|
10
|
+
renderStubDefaultSlot?: boolean;
|
11
|
+
}
|
12
|
+
export declare const registerStub: ({ source, stub, originalStub }: {
|
13
|
+
source: ConcreteComponent;
|
14
|
+
stub: ConcreteComponent;
|
15
|
+
originalStub?: ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions> | undefined;
|
16
|
+
}) => void;
|
17
|
+
export declare const getOriginalVNodeTypeFromStub: (type: ConcreteComponent) => VNodeTypes | undefined;
|
18
|
+
export declare const getOriginalStubFromSpecializedStub: (type: ConcreteComponent) => VNodeTypes | undefined;
|
19
|
+
export declare const addToDoNotStubComponents: (type: ConcreteComponent) => WeakSet<ConcreteComponent<{}, any, any, import("vue").ComputedOptions, import("vue").MethodOptions>>;
|
20
|
+
export declare const createStub: ({ name, type, renderStubDefaultSlot }: StubOptions) => DefineComponent;
|
21
|
+
export declare function stubComponents(stubs?: Stubs, shallow?: boolean, renderStubDefaultSlot?: boolean): void;
|
22
|
+
export {};
|
@@ -0,0 +1,125 @@
|
|
1
|
+
import { Component, ComponentOptions, Directive, Plugin, AppConfig, VNode, VNodeProps, FunctionalComponent, ComponentInternalInstance } from 'vue';
|
2
|
+
export interface RefSelector {
|
3
|
+
ref: string;
|
4
|
+
}
|
5
|
+
export interface NameSelector {
|
6
|
+
name: string;
|
7
|
+
length?: never;
|
8
|
+
}
|
9
|
+
export declare type FindAllComponentsSelector = DefinedComponent | FunctionalComponent | ComponentOptions | NameSelector | string;
|
10
|
+
export declare type FindComponentSelector = RefSelector | FindAllComponentsSelector;
|
11
|
+
export declare type Slot = VNode | string | {
|
12
|
+
render: Function;
|
13
|
+
} | Function | Component;
|
14
|
+
declare type SlotDictionary = {
|
15
|
+
[key: string]: Slot;
|
16
|
+
};
|
17
|
+
declare type RawProps = VNodeProps & {
|
18
|
+
__v_isVNode?: never;
|
19
|
+
[Symbol.iterator]?: never;
|
20
|
+
} & Record<string, any>;
|
21
|
+
export interface MountingOptions<Props, Data = {}> {
|
22
|
+
/**
|
23
|
+
* Overrides component's default data. Must be a function.
|
24
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#data
|
25
|
+
*/
|
26
|
+
data?: () => {} extends Data ? any : Data extends object ? Partial<Data> : any;
|
27
|
+
/**
|
28
|
+
* Sets component props when mounted.
|
29
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#props
|
30
|
+
*/
|
31
|
+
props?: (RawProps & Props) | ({} extends Props ? null : never);
|
32
|
+
/**
|
33
|
+
* @deprecated use `data` instead.
|
34
|
+
*/
|
35
|
+
propsData?: Props;
|
36
|
+
/**
|
37
|
+
* Sets component attributes when mounted.
|
38
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#attrs
|
39
|
+
*/
|
40
|
+
attrs?: Record<string, unknown>;
|
41
|
+
/**
|
42
|
+
* Provide values for slots on a component.
|
43
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#slots
|
44
|
+
*/
|
45
|
+
slots?: SlotDictionary & {
|
46
|
+
default?: Slot;
|
47
|
+
};
|
48
|
+
/**
|
49
|
+
* Provides global mounting options to the component.
|
50
|
+
*/
|
51
|
+
global?: GlobalMountOptions;
|
52
|
+
/**
|
53
|
+
* Specify where to mount the component.
|
54
|
+
* Can be a valid CSS selector, or an Element connected to the document.
|
55
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#attachto
|
56
|
+
*/
|
57
|
+
attachTo?: HTMLElement | string;
|
58
|
+
/**
|
59
|
+
* Automatically stub out all the child components.
|
60
|
+
* @default false
|
61
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#slots
|
62
|
+
*/
|
63
|
+
shallow?: boolean;
|
64
|
+
}
|
65
|
+
export declare type Stub = boolean | Component;
|
66
|
+
export declare type Stubs = Record<string, Stub> | Array<string>;
|
67
|
+
export declare type GlobalMountOptions = {
|
68
|
+
/**
|
69
|
+
* Installs plugins on the component.
|
70
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-plugins
|
71
|
+
*/
|
72
|
+
plugins?: (Plugin | [Plugin, ...any[]])[];
|
73
|
+
/**
|
74
|
+
* Customizes Vue application global configuration
|
75
|
+
* @see https://v3.vuejs.org/api/application-config.html#application-config
|
76
|
+
*/
|
77
|
+
config?: Partial<Omit<AppConfig, 'isNativeTag'>>;
|
78
|
+
/**
|
79
|
+
* Applies a mixin for components under testing.
|
80
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-mixins
|
81
|
+
*/
|
82
|
+
mixins?: ComponentOptions[];
|
83
|
+
/**
|
84
|
+
* Mocks a global instance property.
|
85
|
+
* This is designed to mock variables injected by third party plugins, not
|
86
|
+
* Vue's native properties such as $root, $children, etc.
|
87
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-mocks
|
88
|
+
*/
|
89
|
+
mocks?: Record<string, any>;
|
90
|
+
/**
|
91
|
+
* Provides data to be received in a setup function via `inject`.
|
92
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-provide
|
93
|
+
*/
|
94
|
+
provide?: Record<any, any>;
|
95
|
+
/**
|
96
|
+
* Registers components globally for components under testing.
|
97
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-components
|
98
|
+
*/
|
99
|
+
components?: Record<string, Component | object>;
|
100
|
+
/**
|
101
|
+
* Registers a directive globally for components under testing
|
102
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-directives
|
103
|
+
*/
|
104
|
+
directives?: Record<string, Directive>;
|
105
|
+
/**
|
106
|
+
* Stubs a component for components under testing.
|
107
|
+
* @default "{ transition: true, 'transition-group': true }"
|
108
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-stubs
|
109
|
+
*/
|
110
|
+
stubs?: Stubs;
|
111
|
+
/**
|
112
|
+
* Allows rendering the default slot content, even when using
|
113
|
+
* `shallow` or `shallowMount`.
|
114
|
+
* @default false
|
115
|
+
* @see https://next.vue-test-utils.vuejs.org/api/#global-renderstubdefaultslot
|
116
|
+
*/
|
117
|
+
renderStubDefaultSlot?: boolean;
|
118
|
+
};
|
119
|
+
export declare type VueNode<T extends Node = Node> = T & {
|
120
|
+
__vue_app__?: any;
|
121
|
+
__vueParentComponent?: ComponentInternalInstance;
|
122
|
+
};
|
123
|
+
export declare type VueElement = VueNode<Element>;
|
124
|
+
export declare type DefinedComponent = new (...args: any[]) => any;
|
125
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { ComponentPublicInstance } from 'vue';
|
2
|
+
import type { VueWrapper } from '../vueWrapper';
|
3
|
+
export declare function disableAutoUnmount(): void;
|
4
|
+
export declare function enableAutoUnmount(hook: Function): void;
|
5
|
+
export declare function trackInstance(wrapper: VueWrapper<ComponentPublicInstance>): void;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { ComponentInternalInstance } from '@vue/runtime-core';
|
2
|
+
import { VNodeTypes } from 'vue';
|
3
|
+
export declare const getComponentRegisteredName: (instance: ComponentInternalInstance | null, type: VNodeTypes) => string | null;
|
4
|
+
export declare const getComponentName: (instance: any | null, type: VNodeTypes) => string;
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { ComponentInternalInstance, VNode } from 'vue';
|
2
|
+
import { FindAllComponentsSelector } from '../types';
|
3
|
+
/**
|
4
|
+
* Detect whether a selector matches a VNode
|
5
|
+
* @param node
|
6
|
+
* @param selector
|
7
|
+
* @return {boolean | ((value: any) => boolean)}
|
8
|
+
*/
|
9
|
+
export declare function matches(node: VNode, rawSelector: FindAllComponentsSelector): boolean;
|
10
|
+
export declare function find(root: VNode, selector: FindAllComponentsSelector): ComponentInternalInstance[];
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function flushPromises(): Promise<unknown>;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function isElement(element: Node): element is Element;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function matchName(target: string, sourceName: string): boolean;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function stringifyNode(node: Node): string;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
import type { ComponentOptions } from 'vue';
|
2
|
+
export declare function isLegacyExtendedComponent(component: unknown): component is {
|
3
|
+
(): Function;
|
4
|
+
super: Function;
|
5
|
+
options: ComponentOptions;
|
6
|
+
};
|
7
|
+
export declare function unwrapLegacyVueExtendComponent<T>(selector: T): T | ComponentOptions;
|
8
|
+
export declare function isLegacyFunctionalComponent(component: unknown): boolean;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { GlobalMountOptions, RefSelector } from './types';
|
2
|
+
import { ComponentOptions, ConcreteComponent, FunctionalComponent } from 'vue';
|
3
|
+
export declare function mergeGlobalProperties(mountGlobal?: GlobalMountOptions): Required<GlobalMountOptions>;
|
4
|
+
export declare const isObject: (obj: unknown) => obj is Record<string, any>;
|
5
|
+
export declare const mergeDeep: (target: Record<string, unknown>, source: Record<string, unknown>) => Record<string, any>;
|
6
|
+
export declare function isClassComponent(component: unknown): boolean;
|
7
|
+
export declare function isComponent(component: unknown): component is ConcreteComponent;
|
8
|
+
export declare function isFunctionalComponent(component: unknown): component is FunctionalComponent;
|
9
|
+
export declare function isObjectComponent(component: unknown): component is ComponentOptions;
|
10
|
+
export declare function textContent(element: Node): string;
|
11
|
+
export declare function hasOwnProperty<O extends {}, P extends PropertyKey>(obj: O, prop: P): obj is O & Record<P, unknown>;
|
12
|
+
export declare function isNotNullOrUndefined<T extends {}>(obj: T | null | undefined): obj is T;
|
13
|
+
export declare function isRefSelector(selector: string | RefSelector): selector is RefSelector;
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import { App, ComponentCustomProperties, ComponentPublicInstance } from 'vue';
|
2
|
+
import { VueNode } from './types';
|
3
|
+
import BaseWrapper from './baseWrapper';
|
4
|
+
import type { DOMWrapper } from './domWrapper';
|
5
|
+
export declare class VueWrapper<T extends Omit<ComponentPublicInstance, '$emit' | keyof ComponentCustomProperties> & {
|
6
|
+
$emit: (event: any, ...args: any[]) => void;
|
7
|
+
} & ComponentCustomProperties = ComponentPublicInstance> extends BaseWrapper<Node> {
|
8
|
+
private componentVM;
|
9
|
+
private rootVM;
|
10
|
+
private __app;
|
11
|
+
private __setProps;
|
12
|
+
constructor(app: App | null, vm: T, setProps?: (props: Record<string, unknown>) => void);
|
13
|
+
private get hasMultipleRoots();
|
14
|
+
protected getRootNodes(): VueNode[];
|
15
|
+
private get parentElement();
|
16
|
+
getCurrentComponent(): import("vue").ComponentInternalInstance;
|
17
|
+
exists(): boolean;
|
18
|
+
findAll<K extends keyof HTMLElementTagNameMap>(selector: K): DOMWrapper<HTMLElementTagNameMap[K]>[];
|
19
|
+
findAll<K extends keyof SVGElementTagNameMap>(selector: K): DOMWrapper<SVGElementTagNameMap[K]>[];
|
20
|
+
findAll<T extends Element>(selector: string): DOMWrapper<T>[];
|
21
|
+
private attachNativeEventListener;
|
22
|
+
get element(): Element;
|
23
|
+
get vm(): T;
|
24
|
+
props(): {
|
25
|
+
[key: string]: any;
|
26
|
+
};
|
27
|
+
props(selector: string): any;
|
28
|
+
emitted<T = unknown>(): Record<string, T[]>;
|
29
|
+
emitted<T = unknown[]>(eventName: string): undefined | T[];
|
30
|
+
isVisible(): boolean;
|
31
|
+
setData(data: Record<string, unknown>): Promise<void>;
|
32
|
+
setProps(props: Record<string, unknown>): Promise<void>;
|
33
|
+
setValue(value: unknown, prop?: string): Promise<void>;
|
34
|
+
unmount(): void;
|
35
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ComponentPublicInstance, App } from 'vue';
|
2
|
+
import type { DOMWrapper as DOMWrapperType } from './domWrapper';
|
3
|
+
import type { VueWrapper as VueWrapperType } from './vueWrapper';
|
4
|
+
export declare enum WrapperType {
|
5
|
+
DOMWrapper = 0,
|
6
|
+
VueWrapper = 1
|
7
|
+
}
|
8
|
+
declare type DOMWrapperFactory = <T extends Node>(element: T) => DOMWrapperType<T>;
|
9
|
+
declare type VueWrapperFactory = <T extends ComponentPublicInstance>(app: App | null, vm: T, setProps?: (props: Record<string, unknown>) => Promise<void>) => VueWrapperType<T>;
|
10
|
+
export declare function registerFactory(type: WrapperType.DOMWrapper, fn: DOMWrapperFactory): void;
|
11
|
+
export declare function registerFactory(type: WrapperType.VueWrapper, fn: VueWrapperFactory): void;
|
12
|
+
export declare const createDOMWrapper: DOMWrapperFactory;
|
13
|
+
export declare const createVueWrapper: VueWrapperFactory;
|
14
|
+
export {};
|