1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | import {
|
22 | ReactElement,
|
23 | Component,
|
24 | AllHTMLAttributes as ReactHTMLAttributes,
|
25 | SVGAttributes as ReactSVGAttributes,
|
26 | } from 'react';
|
27 |
|
28 | export type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>;
|
29 |
|
30 | export class ElementClass extends Component<any, any> {}
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 | export interface ComponentClass<Props> {
|
37 | new (props: Props, context?: any): Component<Props>;
|
38 | }
|
39 |
|
40 | export type FunctionComponent<Props> = (props: Props, context?: any) => JSX.Element | null;
|
41 |
|
42 | export type ComponentType<Props> = ComponentClass<Props> | FunctionComponent<Props>;
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 | export interface EnzymePropSelector {
|
55 | [key: string]: any;
|
56 | }
|
57 | export type EnzymeSelector = string | FunctionComponent<any> | ComponentClass<any> | EnzymePropSelector;
|
58 |
|
59 | export type Intercepter<T> = (intercepter: T) => void;
|
60 |
|
61 | export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
|
62 | |
63 |
|
64 |
|
65 | filterWhere(predicate: (wrapper: this) => boolean): this;
|
66 |
|
67 | |
68 |
|
69 |
|
70 | contains(node: ReactElement | ReactElement[] | string | number): boolean;
|
71 |
|
72 | |
73 |
|
74 |
|
75 | containsMatchingElement(node: ReactElement | ReactElement[]): boolean;
|
76 |
|
77 | |
78 |
|
79 |
|
80 | containsAllMatchingElements(nodes: ReactElement[] | ReactElement[][]): boolean;
|
81 |
|
82 | |
83 |
|
84 |
|
85 | containsAnyMatchingElements(nodes: ReactElement[] | ReactElement[][]): boolean;
|
86 |
|
87 | |
88 |
|
89 |
|
90 | equals(node: ReactElement): boolean;
|
91 |
|
92 | |
93 |
|
94 |
|
95 | matchesElement(node: ReactElement): boolean;
|
96 |
|
97 | |
98 |
|
99 |
|
100 | hasClass(className: string | RegExp): boolean;
|
101 |
|
102 | |
103 |
|
104 |
|
105 |
|
106 |
|
107 |
|
108 | invoke<
|
109 | K extends NonNullable<
|
110 | {
|
111 | [K in keyof P]: P[K] extends ((...arg: any[]) => void) | undefined ? K : never;
|
112 | }[keyof P]
|
113 | >
|
114 | >(
|
115 | invokePropName: K,
|
116 | ): P[K];
|
117 |
|
118 | |
119 |
|
120 |
|
121 | is(selector: EnzymeSelector): boolean;
|
122 |
|
123 | |
124 |
|
125 |
|
126 |
|
127 | isEmpty(): boolean;
|
128 |
|
129 | |
130 |
|
131 |
|
132 | exists(selector?: EnzymeSelector): boolean;
|
133 |
|
134 | |
135 |
|
136 |
|
137 |
|
138 | not(selector: EnzymeSelector): this;
|
139 |
|
140 | |
141 |
|
142 |
|
143 |
|
144 |
|
145 |
|
146 |
|
147 | text(): string;
|
148 |
|
149 | |
150 |
|
151 |
|
152 |
|
153 |
|
154 | html(): string;
|
155 |
|
156 | |
157 |
|
158 |
|
159 | get(index: number): ReactElement;
|
160 |
|
161 | |
162 |
|
163 |
|
164 | getNode(): ReactElement;
|
165 |
|
166 | |
167 |
|
168 |
|
169 | getNodes(): ReactElement[];
|
170 |
|
171 | |
172 |
|
173 |
|
174 | getElement(): ReactElement;
|
175 |
|
176 | |
177 |
|
178 |
|
179 | getElements(): ReactElement[];
|
180 |
|
181 | |
182 |
|
183 |
|
184 | getDOMNode<T extends Element = Element>(): T;
|
185 |
|
186 | |
187 |
|
188 |
|
189 | at(index: number): this;
|
190 |
|
191 | |
192 |
|
193 |
|
194 | first(): this;
|
195 |
|
196 | |
197 |
|
198 |
|
199 | last(): this;
|
200 |
|
201 | |
202 |
|
203 |
|
204 | slice(begin?: number, end?: number): this;
|
205 |
|
206 | |
207 |
|
208 |
|
209 | tap(intercepter: Intercepter<this>): this;
|
210 |
|
211 | |
212 |
|
213 |
|
214 | state(): S;
|
215 | state<K extends keyof S>(key: K): S[K];
|
216 | state<T>(key: string): T;
|
217 |
|
218 | |
219 |
|
220 |
|
221 | context(): any;
|
222 | context<T>(key: string): T;
|
223 |
|
224 | |
225 |
|
226 |
|
227 |
|
228 |
|
229 | props(): P;
|
230 |
|
231 | |
232 |
|
233 |
|
234 |
|
235 |
|
236 | prop<K extends keyof P>(key: K): P[K];
|
237 | prop<T>(key: string): T;
|
238 |
|
239 | |
240 |
|
241 |
|
242 |
|
243 | key(): string;
|
244 |
|
245 | |
246 |
|
247 |
|
248 |
|
249 |
|
250 | simulate(event: string, ...args: any[]): this;
|
251 |
|
252 | |
253 |
|
254 |
|
255 |
|
256 |
|
257 | simulateError(error: any): this;
|
258 |
|
259 | |
260 |
|
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 | setState<K extends keyof S>(state: Pick<S, K>, callback?: () => void): this;
|
270 |
|
271 | /**
|
272 | * A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
|
273 | * how the component behaves over time with changing props. Calling this, for instance, will call the
|
274 | * componentWillReceiveProps lifecycle method.
|
275 | *
|
276 | * Similar to setState, this method accepts a props object and will merge it in with the already existing props.
|
277 | * Returns itself.
|
278 | *
|
279 | * NOTE: can only be called on a wrapper instance that is also the root instance.
|
280 | */
|
281 | setProps<K extends keyof P>(props: Pick<P, K>, callback?: () => void): this;
|
282 |
|
283 | /**
|
284 | * A method that sets the context of the root component, and re-renders. Useful for when you are wanting to
|
285 | * test how the component behaves over time with changing contexts.
|
286 | * Returns itself.
|
287 | *
|
288 | * NOTE: can only be called on a wrapper instance that is also the root instance.
|
289 | */
|
290 | setContext(context: any): this;
|
291 |
|
292 | /**
|
293 | * Gets the instance of the component being rendered as the root node passed into shallow().
|
294 | *
|
295 | * NOTE: can only be called on a wrapper instance that is also the root instance.
|
296 | */
|
297 | instance(): C;
|
298 |
|
299 | /**
|
300 | * Forces a re-render. Useful to run before checking the render output if something external may be updating
|
301 | * the state of the component somewhere.
|
302 | * Returns itself.
|
303 | *
|
304 | * NOTE: can only be called on a wrapper instance that is also the root instance.
|
305 | */
|
306 | update(): this;
|
307 |
|
308 | /**
|
309 | * Returns an html-like string of the wrapper for debugging purposes. Useful to print out to the console when
|
310 | * tests are not passing when you expect them to.
|
311 | */
|
312 | debug(options?: {
|
313 |
|
314 | ignoreProps?: boolean | undefined;
|
315 |
|
316 | verbose?: boolean | undefined;
|
317 | }): string;
|
318 |
|
319 | /**
|
320 | * Returns the name of the current node of the wrapper.
|
321 | */
|
322 | name(): string;
|
323 |
|
324 | /**
|
325 | * Iterates through each node of the current wrapper and executes the provided function with a wrapper around
|
326 | * the corresponding node passed in as the first argument.
|
327 | *
|
328 | * Returns itself.
|
329 | * @param fn A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first
|
330 | * argument, and will be run with a context of the original instance.
|
331 | */
|
332 | forEach(fn: (wrapper: this, index: number) => any): this;
|
333 |
|
334 | /**
|
335 | * Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map
|
336 | * function.
|
337 | * Returns an array of the returned values from the mapping function..
|
338 | * @param fn A mapping function to be run for every node in the collection, the results of which will be mapped
|
339 | * to the returned array. Should expect a ShallowWrapper as the first argument, and will be run
|
340 | * with a context of the original instance.
|
341 | */
|
342 | map<V>(fn: (wrapper: this, index: number) => V): V[];
|
343 |
|
344 | /**
|
345 | * Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node
|
346 | * is passed in as a ShallowWrapper, and is processed from left to right.
|
347 | */
|
348 | reduce<R>(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R;
|
349 |
|
350 | /**
|
351 | * Applies the provided reducing function to every node in the wrapper to reduce to a single value.
|
352 | * Each node is passed in as a ShallowWrapper, and is processed from right to left.
|
353 | */
|
354 | reduceRight<R>(fn: (prevVal: R, wrapper: this, index: number) => R, initialValue?: R): R;
|
355 |
|
356 | /**
|
357 | * Returns whether or not any of the nodes in the wrapper match the provided selector.
|
358 | */
|
359 | some(selector: EnzymeSelector): boolean;
|
360 |
|
361 | /**
|
362 | * Returns whether or not any of the nodes in the wrapper pass the provided predicate function.
|
363 | */
|
364 | someWhere(fn: (wrapper: this) => boolean): boolean;
|
365 |
|
366 | /**
|
367 | * Returns whether or not all of the nodes in the wrapper match the provided selector.
|
368 | */
|
369 | every(selector: EnzymeSelector): boolean;
|
370 |
|
371 | /**
|
372 | * Returns whether or not all of the nodes in the wrapper pass the provided predicate function.
|
373 | */
|
374 | everyWhere(fn: (wrapper: this) => boolean): boolean;
|
375 |
|
376 | /**
|
377 | * Returns true if renderer returned null
|
378 | */
|
379 | isEmptyRender(): boolean;
|
380 |
|
381 | /**
|
382 | * Renders the component to static markup and returns a Cheerio wrapper around the result.
|
383 | */
|
384 | render(): cheerio.Cheerio;
|
385 |
|
386 | /**
|
387 | * Returns the type of the current node of this wrapper. If it's a composite component, this will be the
|
388 | * component constructor. If it's native DOM node, it will be a string of the tag name.
|
389 | *
|
390 | * Note: can only be called on a wrapper of a single node.
|
391 | */
|
392 | type(): string | ComponentClass<P> | FunctionComponent<P>;
|
393 |
|
394 | length: number;
|
395 | }
|
396 |
|
397 | export type Parameters<T> = T extends (...args: infer A) => any ? A : never;
|
398 |
|
399 | export interface ShallowWrapper<P = {}, S = {}, C = Component> extends CommonWrapper<P, S, C> {}
|
400 | export class ShallowWrapper<P = {}, S = {}, C = Component> {
|
401 | constructor(nodes: JSX.Element[] | JSX.Element, root?: ShallowWrapper<any, any>, options?: ShallowRendererProps);
|
402 | shallow(options?: ShallowRendererProps): ShallowWrapper<P, S>;
|
403 | unmount(): this;
|
404 |
|
405 | /**
|
406 | * Find every node in the render tree that matches the provided selector.
|
407 | * @param selector The selector to match.
|
408 | */
|
409 | find<P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
|
410 | find<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
411 | find<C2 extends Component>(
|
412 | componentClass: ComponentClass<C2['props']>,
|
413 | ): ShallowWrapper<C2['props'], C2['state'], C2>;
|
414 | find(props: EnzymePropSelector): ShallowWrapper<any, any>;
|
415 | find(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
416 |
|
417 | /**
|
418 | * Removes nodes in the current wrapper that do not match the provided selector.
|
419 | * @param selector The selector to match.
|
420 | */
|
421 | filter<P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
|
422 | filter<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
423 | filter(props: EnzymePropSelector | string): ShallowWrapper<P, S>;
|
424 |
|
425 | /**
|
426 | * Finds every node in the render tree that returns true for the provided predicate function.
|
427 | */
|
428 | findWhere(predicate: (wrapper: ShallowWrapper<any, any>) => boolean): ShallowWrapper<any, any>;
|
429 |
|
430 | /**
|
431 | * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
|
432 | * can be provided and it will filter the children by this selector.
|
433 | */
|
434 | children<P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
|
435 | children<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
436 | children(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
437 | children(props?: EnzymePropSelector): ShallowWrapper<any, any>;
|
438 |
|
439 | /**
|
440 | * Returns a new wrapper with child at the specified index.
|
441 | */
|
442 | childAt(index: number): ShallowWrapper<any, any>;
|
443 | childAt<P2, S2>(index: number): ShallowWrapper<P2, S2>;
|
444 |
|
445 | /**
|
446 | * Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result.
|
447 | * NOTE: can only be called on wrapper of a single non-DOM component element node.
|
448 | */
|
449 | dive<C2 extends Component, P2 = C2['props'], S2 = C2['state']>(
|
450 | options?: ShallowRendererProps,
|
451 | ): ShallowWrapper<P2, S2, C2>;
|
452 | dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
|
453 | dive<P2, S2, C2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2, C2>;
|
454 |
|
455 | /**
|
456 | * Strips out all the not host-nodes from the list of nodes
|
457 | *
|
458 | * This method is useful if you want to check for the presence of host nodes
|
459 | * (actually rendered HTML elements) ignoring the React nodes.
|
460 | */
|
461 | hostNodes(): ShallowWrapper<HTMLAttributes>;
|
462 |
|
463 | /**
|
464 | * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
|
465 | * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
|
466 | *
|
467 | * Note: can only be called on a wrapper of a single node.
|
468 | */
|
469 | parents<P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
|
470 | parents<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
471 | parents(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
472 | parents(props?: EnzymePropSelector): ShallowWrapper<any, any>;
|
473 |
|
474 | /**
|
475 | * Returns a wrapper of the first element that matches the selector by traversing up through the current node's
|
476 | * ancestors in the tree, starting with itself.
|
477 | *
|
478 | * Note: can only be called on a wrapper of a single node.
|
479 | */
|
480 | closest<P2>(statelessComponent: FunctionComponent<P2>): ShallowWrapper<P2, never>;
|
481 | closest<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
|
482 | closest(props: EnzymePropSelector): ShallowWrapper<any, any>;
|
483 | closest(selector: string): ShallowWrapper<HTMLAttributes, any>;
|
484 |
|
485 | /**
|
486 | * Returns a wrapper with the direct parent of the node in the current wrapper.
|
487 | */
|
488 | parent(): ShallowWrapper<any, any>;
|
489 |
|
490 | /**
|
491 | * Returns a wrapper of the node rendered by the provided render prop.
|
492 | */
|
493 | renderProp<PropName extends keyof P>(
|
494 | prop: PropName,
|
495 | ): (...params: Parameters<P[PropName]>) => ShallowWrapper<any, never>;
|
496 |
|
497 | /**
|
498 | * If a wrappingComponent was passed in options,
|
499 | * this methods returns a ShallowWrapper around the rendered wrappingComponent.
|
500 | * This ShallowWrapper can be used to update the wrappingComponent's props and state
|
501 | */
|
502 | getWrappingComponent: () => ShallowWrapper;
|
503 | }
|
504 |
|
505 | export interface ReactWrapper<P = {}, S = {}, C = Component> extends CommonWrapper<P, S, C> {}
|
506 | export class ReactWrapper<P = {}, S = {}, C = Component> {
|
507 | constructor(nodes: JSX.Element | JSX.Element[], root?: ReactWrapper<any, any>, options?: MountRendererProps);
|
508 |
|
509 | unmount(): this;
|
510 | mount(): this;
|
511 |
|
512 | /**
|
513 | * Returns a wrapper of the node that matches the provided reference name.
|
514 | *
|
515 | * NOTE: can only be called on a wrapper instance that is also the root instance.
|
516 | */
|
517 | ref(refName: string): ReactWrapper<any, any>;
|
518 | ref<P2, S2>(refName: string): ReactWrapper<P2, S2>;
|
519 |
|
520 | /**
|
521 | * Detaches the react tree from the DOM. Runs ReactDOM.unmountComponentAtNode() under the hood.
|
522 | *
|
523 | * This method will most commonly be used as a "cleanup" method if you decide to use the attachTo option in mount(node, options).
|
524 | *
|
525 | * The method is intentionally not "fluent" (in that it doesn't return this) because you should not be doing anything with this wrapper after this method is called.
|
526 | *
|
527 | * Using the attachTo is not generally recommended unless it is absolutely necessary to test something.
|
528 | * It is your responsibility to clean up after yourself at the end of the test if you do decide to use it, though.
|
529 | */
|
530 | detach(): void;
|
531 |
|
532 | /**
|
533 | * Strips out all the not host-nodes from the list of nodes
|
534 | *
|
535 | * This method is useful if you want to check for the presence of host nodes
|
536 | * (actually rendered HTML elements) ignoring the React nodes.
|
537 | */
|
538 | hostNodes(): ReactWrapper<HTMLAttributes>;
|
539 |
|
540 | /**
|
541 | * Find every node in the render tree that matches the provided selector.
|
542 | * @param selector The selector to match.
|
543 | */
|
544 | find<P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
|
545 | find<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
546 | find<C2 extends Component>(componentClass: ComponentClass<C2['props']>): ReactWrapper<C2['props'], C2['state'], C2>;
|
547 | find(props: EnzymePropSelector): ReactWrapper<any, any>;
|
548 | find(selector: string): ReactWrapper<HTMLAttributes, any>;
|
549 |
|
550 | /**
|
551 | * Finds every node in the render tree that returns true for the provided predicate function.
|
552 | */
|
553 | findWhere(predicate: (wrapper: ReactWrapper<any, any>) => boolean): ReactWrapper<any, any>;
|
554 |
|
555 | /**
|
556 | * Removes nodes in the current wrapper that do not match the provided selector.
|
557 | * @param selector The selector to match.
|
558 | */
|
559 | filter<P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
|
560 | filter<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
561 | filter(props: EnzymePropSelector | string): ReactWrapper<P, S>;
|
562 |
|
563 | /**
|
564 | * Returns a new wrapper with all of the children of the node(s) in the current wrapper. Optionally, a selector
|
565 | * can be provided and it will filter the children by this selector.
|
566 | */
|
567 | children<P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
|
568 | children<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
569 | children(selector: string): ReactWrapper<HTMLAttributes, any>;
|
570 | children(props?: EnzymePropSelector): ReactWrapper<any, any>;
|
571 |
|
572 | /**
|
573 | * Returns a new wrapper with child at the specified index.
|
574 | */
|
575 | childAt(index: number): ReactWrapper<any, any>;
|
576 | childAt<P2, S2>(index: number): ReactWrapper<P2, S2>;
|
577 |
|
578 | /**
|
579 | * Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
|
580 | * current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
|
581 | *
|
582 | * Note: can only be called on a wrapper of a single node.
|
583 | */
|
584 | parents<P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
|
585 | parents<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
586 | parents(selector: string): ReactWrapper<HTMLAttributes, any>;
|
587 | parents(props?: EnzymePropSelector): ReactWrapper<any, any>;
|
588 |
|
589 | /**
|
590 | * Returns a wrapper of the first element that matches the selector by traversing up through the current node's
|
591 | * ancestors in the tree, starting with itself.
|
592 | *
|
593 | * Note: can only be called on a wrapper of a single node.
|
594 | */
|
595 | closest<P2>(statelessComponent: FunctionComponent<P2>): ReactWrapper<P2, never>;
|
596 | closest<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
|
597 | closest(props: EnzymePropSelector): ReactWrapper<any, any>;
|
598 | closest(selector: string): ReactWrapper<HTMLAttributes, any>;
|
599 |
|
600 | /**
|
601 | * Returns a wrapper with the direct parent of the node in the current wrapper.
|
602 | */
|
603 | parent(): ReactWrapper<any, any>;
|
604 |
|
605 | /**
|
606 | * Returns a wrapper of the node rendered by the provided render prop.
|
607 | */
|
608 | renderProp<PropName extends keyof P>(
|
609 | prop: PropName,
|
610 | ): (...params: Parameters<P[PropName]>) => ReactWrapper<any, never>;
|
611 |
|
612 | /**
|
613 | * If a wrappingComponent was passed in options,
|
614 | * this methods returns a ReactWrapper around the rendered wrappingComponent.
|
615 | * This ReactWrapper can be used to update the wrappingComponent's props and state
|
616 | */
|
617 | getWrappingComponent: () => ReactWrapper;
|
618 | }
|
619 |
|
620 | export interface Lifecycles {
|
621 | componentDidUpdate?: {
|
622 | onSetState: boolean;
|
623 | prevContext: boolean;
|
624 | } | undefined;
|
625 | getDerivedStateFromProps?: { hasShouldComponentUpdateBug: boolean } | boolean | undefined;
|
626 | getChildContext?: {
|
627 | calledByRenderer: boolean;
|
628 | [key: string]: any;
|
629 | } | undefined;
|
630 | setState?: any;
|
631 |
|
632 | [lifecycleName: string]: any;
|
633 | }
|
634 |
|
635 | export interface ShallowRendererProps {
|
636 |
|
637 | |
638 |
|
639 |
|
640 |
|
641 | disableLifecycleMethods?: boolean | undefined;
|
642 | |
643 |
|
644 |
|
645 | lifecycleExperimental?: boolean | undefined;
|
646 | |
647 |
|
648 |
|
649 | context?: any;
|
650 | |
651 |
|
652 |
|
653 |
|
654 | enableComponentDidUpdateOnSetState?: boolean | undefined;
|
655 | |
656 |
|
657 |
|
658 |
|
659 | supportPrevContextArgumentOfComponentDidUpdate?: boolean | undefined;
|
660 | lifecycles?: Lifecycles | undefined;
|
661 | |
662 |
|
663 |
|
664 |
|
665 |
|
666 |
|
667 | wrappingComponent?: ComponentType<any> | undefined;
|
668 | |
669 |
|
670 |
|
671 | wrappingComponentProps?: {} | undefined;
|
672 | |
673 |
|
674 |
|
675 |
|
676 |
|
677 | suspenseFallback?: boolean | undefined;
|
678 | adapter?: EnzymeAdapter | undefined;
|
679 |
|
680 | attachTo?: any;
|
681 | hydrateIn?: any;
|
682 | PROVIDER_VALUES?: any;
|
683 | }
|
684 |
|
685 | export interface MountRendererProps {
|
686 | |
687 |
|
688 |
|
689 | context?: {} | undefined;
|
690 | |
691 |
|
692 |
|
693 | attachTo?: HTMLElement | null | undefined;
|
694 | |
695 |
|
696 |
|
697 | childContextTypes?: {} | undefined;
|
698 | |
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 | wrappingComponent?: ComponentType<any> | undefined;
|
705 | |
706 |
|
707 |
|
708 | wrappingComponentProps?: {} | undefined;
|
709 | }
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 | export function shallow<C extends Component, P = C['props'], S = C['state']>(
|
716 | node: ReactElement<P>,
|
717 | options?: ShallowRendererProps,
|
718 | ): ShallowWrapper<P, S, C>;
|
719 | export function shallow<P>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, any>;
|
720 | export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, S>;
|
721 |
|
722 |
|
723 |
|
724 |
|
725 | export function mount<C extends Component, P = C['props'], S = C['state']>(
|
726 | node: ReactElement<P>,
|
727 | options?: MountRendererProps,
|
728 | ): ReactWrapper<P, S, C>;
|
729 | export function mount<P>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, any>;
|
730 | export function mount<P, S>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, S>;
|
731 |
|
732 |
|
733 |
|
734 |
|
735 | export function render<P, S>(node: ReactElement<P>, options?: any): cheerio.Cheerio;
|
736 |
|
737 |
|
738 | export class EnzymeAdapter {
|
739 | wrapWithWrappingComponent?: ((node: ReactElement, options?: ShallowRendererProps) => any) | undefined;
|
740 | }
|
741 |
|
742 | /**
|
743 | * Configure enzyme to use the correct adapter for the react version
|
744 | * This is enabling the Enzyme configuration with adapters in TS
|
745 | */
|
746 | export function configure(options: {
|
747 | adapter: EnzymeAdapter;
|
748 |
|
749 |
|
750 |
|
751 | |
752 |
|
753 |
|
754 |
|
755 | disableLifecycleMethods?: boolean | undefined;
|
756 | }): void;
|
757 |
|
\ | No newline at end of file |