[Enzyme]: adds number as possible arg for contains (#47273)

* adds number to contains

* update enzyme version

* Revert version

Co-authored-by: Jordan Harband <ljharb@gmail.com>

Co-authored-by: Jordan Harband <ljharb@gmail.com>
This commit is contained in:
Abner Soares Alves Junior 2020-09-08 09:23:40 -03:00 committed by GitHub
parent 443f301bd3
commit 26524111ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -67,7 +67,7 @@ export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
/**
* Returns whether or not the current wrapper has a node anywhere in it's render tree that looks like the one passed in.
*/
contains(node: ReactElement | ReactElement[] | string): boolean;
contains(node: ReactElement | ReactElement[] | string | number): boolean;
/**
* Returns whether or not a given react element exists in the shallow render tree.
@ -112,7 +112,7 @@ export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
}[keyof P]
>
>(
invokePropName: K
invokePropName: K,
): P[K];
/**
@ -410,7 +410,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
find<P2>(statelessComponent: StatelessComponent<P2>): ShallowWrapper<P2, never>;
find<P2>(component: ComponentType<P2>): ShallowWrapper<P2, any>;
find<C2 extends Component>(
componentClass: ComponentClass<C2['props']>,
componentClass: ComponentClass<C2['props']>,
): ShallowWrapper<C2['props'], C2['state'], C2>;
find(props: EnzymePropSelector): ShallowWrapper<any, any>;
find(selector: string): ShallowWrapper<HTMLAttributes, any>;
@ -448,7 +448,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
* NOTE: can only be called on wrapper of a single non-DOM component element node.
*/
dive<C2 extends Component, P2 = C2['props'], S2 = C2['state']>(
options?: ShallowRendererProps
options?: ShallowRendererProps,
): ShallowWrapper<P2, S2, C2>;
dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
dive<P2, S2, C2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2, C2>;
@ -492,7 +492,7 @@ export class ShallowWrapper<P = {}, S = {}, C = Component> {
* Returns a wrapper of the node rendered by the provided render prop.
*/
renderProp<PropName extends keyof P>(
prop: PropName
prop: PropName,
): (...params: Parameters<P[PropName]>) => ShallowWrapper<any, never>;
/**
@ -545,9 +545,7 @@ export class ReactWrapper<P = {}, S = {}, C = Component> {
*/
find<P2>(statelessComponent: StatelessComponent<P2>): ReactWrapper<P2, never>;
find<P2>(component: ComponentType<P2>): ReactWrapper<P2, any>;
find<C2 extends Component>(
componentClass: ComponentClass<C2['props']>,
): ReactWrapper<C2['props'], C2['state'], C2>;
find<C2 extends Component>(componentClass: ComponentClass<C2['props']>): ReactWrapper<C2['props'], C2['state'], C2>;
find(props: EnzymePropSelector): ReactWrapper<any, any>;
find(selector: string): ReactWrapper<HTMLAttributes, any>;
@ -711,7 +709,7 @@ export interface MountRendererProps {
*/
export function shallow<C extends Component, P = C['props'], S = C['state']>(
node: ReactElement<P>,
options?: ShallowRendererProps
options?: ShallowRendererProps,
): ShallowWrapper<P, S, C>;
export function shallow<P>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, any>;
export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererProps): ShallowWrapper<P, S>;
@ -721,7 +719,7 @@ export function shallow<P, S>(node: ReactElement<P>, options?: ShallowRendererPr
*/
export function mount<C extends Component, P = C['props'], S = C['state']>(
node: ReactElement<P>,
options?: MountRendererProps
options?: MountRendererProps,
): ReactWrapper<P, S, C>;
export function mount<P>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, any>;
export function mount<P, S>(node: ReactElement<P>, options?: MountRendererProps): ReactWrapper<P, S>;