<commit_before>// Type definitions for Enzyme 3.1
// Project: https://github.com/airbnb/enzyme
// Definitions by: <NAME> <https://github.com/MarianPalkus>
//                 Cap3 <http://www.cap3.de>
//                 <NAME> <https://github.com/NoHomey>
//                 jwbay <https://github.com/jwbay>
//                 huhuanming <https://github.com/huhuanming>
//                 MartynasZilinskas <https://github.com/MartynasZilinskas>
//                 <NAME> <https://github.com/thovden>
//                 <NAME> <https://github.com/hotell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

/// <reference types="cheerio" />
import { ReactElement, Component, AllHTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react";

export type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>;

export class ElementClass extends Component<any, any> {
}

/* These are purposefully stripped down versions of React.ComponentClass and React.StatelessComponent.
 * The optional static properties on them break overload ordering for wrapper methods if they're not
 * all specified in the implementation. TS chooses the EnzymePropSelector overload and loses the generics
 */
export interface ComponentClass<Props> {
    new(props: Props, context?: any): Component<Props>;
}

export type StatelessComponent<Props> = (props: Props, context?: any) => JSX.Element;

/**
 * Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the
 * following three categories:
 *
 *  1. A Valid CSS Selector
 *  2. A React Component Constructor
 *  3. A React Component's displayName
 *  4. A React Stateless component
 *  5. A React component property map
 */
export interface EnzymePropSelector {
    [key: string]: any;
}
export type EnzymeSelector = string | StatelessComponent<any> | ComponentClass<any> | EnzymePropSelector;

export type Intercepter<T> = (intercepter: T) => void;

export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
    /**
     * Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true.
     */
    filterWhere(predicate: (wrapper: this) => boolean): this;

    /**
     * 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<any> | Array<ReactElement<any>> | string): boolean;

    /**
     * Returns whether or not a given react element exists in the shallow render tree.
     */
    containsMatchingElement(node: ReactElement<any> | Array<ReactElement<any>>): boolean;

    /**
     * Returns whether or not all the given react elements exists in the shallow render tree
     */
    containsAllMatchingElements(nodes: Array<ReactElement<any>> | Array<Array<ReactElement<any>>>): boolean;

    /**
     * Returns whether or not one of the given react elements exists in the shallow render tree.
     */
    containsAnyMatchingElements(nodes: Array<ReactElement<any>> | Array<Array<ReactElement<any>>>): boolean;

    /**
     * Returns whether or not the current render tree is equal to the given node, based on the expected value.
     */
    equals(node: ReactElement<any>): boolean;

    /**
     * Returns whether or not a given react element matches the shallow render tree.
     */
    matchesElement(node: ReactElement<any>): boolean;

    /**
     * Returns whether or not the current node has a className prop including the passed in class name.
     */
    hasClass(className: string): boolean;

    /**
     * Returns whether or not the current node matches a provided selector.
     */
    is(selector: EnzymeSelector): boolean;

    /**
     * Returns whether or not the current node is empty.
     * @deprecated Use .exists() instead.
     */
    isEmpty(): boolean;

    /**
     * Returns whether or not the current node exists.
     */
    exists(): boolean;

    /**
     * Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector.
     * This method is effectively the negation or inverse of filter.
     */
    not(selector: EnzymeSelector): this;

    /**
     * Returns a string of the rendered text of the current render tree. This function should be looked at with
     * skepticism if being used to test what the actual HTML output of the component will be. If that is what you
     * would like to test, use enzyme's render function instead.
     *<commit_msg>Add argument to .exists method<commit_after>// Type definitions for Enzyme 3.1
// Project: https://github.com/airbnb/enzyme
// Definitions by: <NAME> <https://github.com/MarianPalkus>
//                 Cap3 <http://www.cap3.de>
//                 <NAME> <https://github.com/NoHomey>
//                 jwbay <https://github.com/jwbay>
//                 huhuanming <https://github.com/huhuanming>
//                 MartynasZilinskas <https://github.com/MartynasZilinskas>
//                 <NAME> <https://github.com/thovden>
//                 <NAME> <https://github.com/hotell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

/// <reference types="cheerio" />
import { ReactElement, Component, AllHTMLAttributes as ReactHTMLAttributes, SVGAttributes as ReactSVGAttributes } from "react";

export type HTMLAttributes = ReactHTMLAttributes<{}> & ReactSVGAttributes<{}>;

export class ElementClass extends Component<any, any> {
}

/* These are purposefully stripped down versions of React.ComponentClass and React.StatelessComponent.
 * The optional static properties on them break overload ordering for wrapper methods if they're not
 * all specified in the implementation. TS chooses the EnzymePropSelector overload and loses the generics
 */
export interface ComponentClass<Props> {
    new(props: Props, context?: any): Component<Props>;
}

export type StatelessComponent<Props> = (props: Props, context?: any) => JSX.Element;

/**
 * Many methods in Enzyme's API accept a selector as an argument. Selectors in Enzyme can fall into one of the
 * following three categories:
 *
 *  1. A Valid CSS Selector
 *  2. A React Component Constructor
 *  3. A React Component's displayName
 *  4. A React Stateless component
 *  5. A React component property map
 */
export interface EnzymePropSelector {
    [key: string]: any;
}
export type EnzymeSelector = string | StatelessComponent<any> | ComponentClass<any> | EnzymePropSelector;

export type Intercepter<T> = (intercepter: T) => void;

export interface CommonWrapper<P = {}, S = {}, C = Component<P, S>> {
    /**
     * Returns a new wrapper with only the nodes of the current wrapper that, when passed into the provided predicate function, return true.
     */
    filterWhere(predicate: (wrapper: this) => boolean): this;

    /**
     * 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<any> | Array<ReactElement<any>> | string): boolean;

    /**
     * Returns whether or not a given react element exists in the shallow render tree.
     */
    containsMatchingElement(node: ReactElement<any> | Array<ReactElement<any>>): boolean;

    /**
     * Returns whether or not all the given react elements exists in the shallow render tree
     */
    containsAllMatchingElements(nodes: Array<ReactElement<any>> | Array<Array<ReactElement<any>>>): boolean;

    /**
     * Returns whether or not one of the given react elements exists in the shallow render tree.
     */
    containsAnyMatchingElements(nodes: Array<ReactElement<any>> | Array<Array<ReactElement<any>>>): boolean;

    /**
     * Returns whether or not the current render tree is equal to the given node, based on the expected value.
     */
    equals(node: ReactElement<any>): boolean;

    /**
     * Returns whether or not a given react element matches the shallow render tree.
     */
    matchesElement(node: ReactElement<any>): boolean;

    /**
     * Returns whether or not the current node has a className prop including the passed in class name.
     */
    hasClass(className: string): boolean;

    /**
     * Returns whether or not the current node matches a provided selector.
     */
    is(selector: EnzymeSelector): boolean;

    /**
     * Returns whether or not the current node is empty.
     * @deprecated Use .exists() instead.
     */
    isEmpty(): boolean;

    /**
     * Returns whether or not the current node exists.
     */
    exists(selector?: EnzymeSelector): boolean;

    /**
     * Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector.
     * This method is effectively the negation or inverse of filter.
     */
    not(selector: EnzymeSelector): this;

    /**
     * Returns a string of the rendered text of the current render tree. This function should be looked at with
     * skepticism if being used to test what the actual HTML output of the component will be. If that is what you
     * would like to test, use enzyme's render function instead.
     *
{'fraction_non_alphanumeric': 0.0989787049109083, 'fraction_numerical': 0.0023902651021295088, 'mean_word_length': 3.1408007197480883, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 93, 'https://': 18, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5182119', 'n_tokens_mistral': 2477, 'n_tokens_neox': 2407, 'n_words': 951}