@guardian/threads
Version:
171 lines (170 loc) • 23.7 kB
TypeScript
/// <reference types="testing-library__react" />
import React from 'react';
import { SelectFilterOption } from '../../../Filter';
import { QueryElement } from '../../../StructuredQuery';
interface RenderHelperOptions {
value?: string;
onInputChange?: (str: string) => Promise<SelectFilterOption[]>;
onUpdate?: (q: QueryElement[]) => void;
}
/**
* Render an InputSupper with a focused SelectAsyncChip surrounded by
* InlineText elements. Passes back commonly selected elements to reduce
* test boilerplate.
*/
export declare const renderFocusedAsyncChip: (options?: RenderHelperOptions) => {
selectAsyncChipInput: HTMLInputElement;
selectAsyncChipWrapper: HTMLInputElement;
lhsInlineInput: HTMLInputElement;
rhsInlineInput: HTMLInputElement;
container: HTMLElement;
baseElement: HTMLElement;
debug: (baseElement?: HTMLElement | DocumentFragment | (HTMLElement | DocumentFragment)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format/build/types").OptionsReceived | undefined) => void;
rerender: (ui: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) => void;
unmount: () => boolean;
asFragment: () => DocumentFragment;
getByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
};
/**
* As with renderFocusedAsyncChip, but adds input to the focused chip,
* which should expose a menu element with the provided options for testing.
*/
export declare const renderFocusedAsyncChipWithMenu: (options?: RenderHelperOptions) => Promise<{
menuItems: HTMLElement[];
selectAsyncChipInput: HTMLInputElement;
selectAsyncChipWrapper: HTMLInputElement;
lhsInlineInput: HTMLInputElement;
rhsInlineInput: HTMLInputElement;
container: HTMLElement;
baseElement: HTMLElement;
debug: (baseElement?: HTMLElement | DocumentFragment | (HTMLElement | DocumentFragment)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format/build/types").OptionsReceived | undefined) => void;
rerender: (ui: React.ReactElement<any, string | ((props: any) => React.ReactElement<any, string | any | (new (props: any) => React.Component<any, any, any>)> | null) | (new (props: any) => React.Component<any, any, any>)>) => void;
unmount: () => boolean;
asFragment: () => DocumentFragment;
getByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByLabelText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByPlaceholderText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByAltText: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByTitle: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByDisplayValue: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByRole: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
getByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement;
getAllByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
queryByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement | null;
queryAllByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: unknown) => HTMLElement[];
findByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement>;
findAllByTestId: (text: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").WaitForElementOptions | undefined) => Promise<HTMLElement[]>;
}>;
export declare const keyCodes: {
ArrowUp: {
key: string;
code: string;
};
ArrowDown: {
key: string;
code: string;
};
ArrowLeft: {
key: string;
code: string;
};
ArrowRight: {
key: string;
code: string;
};
Enter: {
key: string;
code: string;
};
Backspace: {
key: string;
code: string;
};
Delete: {
key: string;
code: string;
};
};
export {};