/// /// export type Selector = string | HTMLElement | JQuery; /** * Find an element by a test ID. * * @param id The test ID assigned to the `data-testid` attribute. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @throws Will throw if multiple elements match or if no element matches. * * @see $getAllByTestId Use the `getAll` variant if you want to match * multiple elements. * @see $queryByTestId Use the `query` variant if you want to check * that an element is not rendered. * * @example * $render(); * $getByTestId('submit').text() === 'Click me' */ export declare function $getByTestId(id: string, container?: Selector): JQuery; /** * Find all the elements that match a test ID. * * @param id The test ID assigned to the `data-testid` attribute. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @throws If there are no matching elements an error will be thrown. * * @see $getByTestId Use the `get` variant if you're looking for a single element. * @see $queryByTestId Use the `query` variant if you want to check * that an element is not rendered. * * @example * $render(); * $getAllByTestId('submit').length === 1 */ export declare function $getAllByTestId(id: string, container?: Selector): JQuery; /** * Find a single element that matches a test ID. * * @param id The test ID assigned to the `data-testid` attribute. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @returns If there are no matching elements `null` will be returned. * * @throws Will throw if multiple elements match. * * @see $getByTestId Use the `get` variant if you're looking for a single element. * @see $getAllByTestId Use the `getAll` variant if you want to match * multiple elements. * * @example * $render(); * $getAllByTestId('submit').length === 1 */ export declare function $queryByTestId(id: string, container?: Selector): JQuery | null; /** * Find an element in the currently rendered component that contains the given text. * * @param contains A substring to look for. The search is case **insensitive**. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @throws Will throw if multiple elements match, or if no element matches. * * @example * $render(); * $getByText('Click').text() === 'Click me' */ export declare function $getByText(contains: string, container?: Selector): JQuery; /** * Find an element in the currently rendered component that matches the given RegExp. * * @param matches A regular expression. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @throws Will throw if multiple elements match, or if no element matches. * * @example * $render(); * $getByText(/click/).text() === 'Click me' */ export declare function $getByText(matches: RegExp, container?: Selector): JQuery; /** * Find an element in the currently rendered component that contains the given text. * * @param contains A substring to look for. The search is case **insensitive**. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @returns If there are no matching elements `null` will be returned. * * @throws Will throw if multiple elements match. * * @example * $render(); * $queryByText('Click').text() === 'Click me' */ export declare function $queryByText(contains: string, container?: Selector): JQuery | null; /** * Find an element in the currently rendered component that matches the given RegExp. * * @param matches A regular expression. * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @returns If there are no matching elements `null` will be returned. * * @throws Will throw if multiple elements match. * * @example * $render(); * $queryByText(/click/).text() === 'Click me' */ export declare function $queryByText(matches: RegExp, container?: Selector): JQuery | null; export declare class NonExistentElement extends Error { constructor(selector: Selector); } /** * jQuery's `find` method. * * @param selector Can be any CSS selector or jQuery powered selector. * * @see https://api.jquery.com/find/ * * @param container By default, the function will search through the whole component * that's currently rendered. You can override this by passing an optional container. * * @returns A jQuery collection. * * @example * $render(some text); * console.log($find('#text').text()); // some text */ export declare function $find(selector: Selector, container?: Selector): JQuery; /** * Get the first element that matches the selector from the currently rendered component. */ export declare function getDOMElement(selector: Selector): HTMLElement; /** * Get a readable representation of a DOM element. * * @param selector If not given the container for the currently rendered component * will be used. * @param maxLength Limit the length of the output. * * @example * $render(
foobar
); * console.log($prettyDOM()) * * @example * $render(
foobar
); * console.log($prettyDOM($find('span'))) */ export declare function $prettyDOM(selector?: Selector, maxLength?: number): string;