import React from 'react'; import { render as rtlRender, RenderOptions, RenderResult } from '@testing-library/react'; import { RunOptions } from 'axe-core'; declare type UI = Parameters[0]; declare function ChildrenPassthrough({ children }: { children: React.ReactElement; }): React.ReactElement React.ReactElement | null) | (new (props: any) => React.Component)>; export interface TestOptions extends Omit { /** * optional additional wrapper, e.g. Context * * @example * ```ts * // single wrapper * render(, { * wrapper: MyContext * }); * * // multiple wrapper * render(, { * wrapper: ({ children }) => ( * * * {children} * * * ) * }); * * ``` */ wrapper?: typeof ChildrenPassthrough; } /** * Custom render for @testing-library/react * * @see https://testing-library.com/docs/react-testing-library/setup#custom-render * @param component the component under test * @param options customized test options */ export declare const render: (ui: UI, { wrapper: Wrapper, ...options }?: TestOptions) => RenderResult; declare type TestA11YOptions = TestOptions & { axeOptions?: RunOptions; }; /** * Validates against common a11y mistakes. * * Wrapper for jest-axe * * @example * ```jsx * it('passes a11y test', async () => { * await testA11Y(, options); * }); * * // sometimes we need to perform interactions first to render conditional UI * it('passes a11y test when open', async () => { * const { container } = render(, options); * * fireEvent.click(screen.getByRole('button')); * * await testA11Y(container, options); * }); * ``` * * @see https://github.com/nickcolley/jest-axe#testing-react-with-react-testing-library */ export declare const testA11y: (ui: UI | Element, { axeOptions, ...options }?: TestA11YOptions) => Promise; export {};