UNPKG

@atomic-testing/react-19

Version:

Adapter for integrating [Atomic Testing](https://atomic-testing.dev) with [React 19](https://react.dev). It maps React components to the core scene part APIs.

32 lines (31 loc) 1.59 kB
import { ReactNode } from "react"; import { IComponentDriverOption, ScenePart, TestEngine } from "@atomic-testing/core"; //#region src/types.d.ts interface IReactTestEngineOption extends IComponentDriverOption { rootElement?: Element; } //#endregion //#region src/createTestEngine.d.ts /** * Create test engine for React 18 or later, for React 17 or before, use createLegacyTestEngine * This function takes a react node and render it into a container element. For rendered * components, use createRenderedTestEngine * @param node The React node to render * @param partDefinitions The scene part definitions * @param option * @returns The test engine */ declare function createTestEngine<T extends ScenePart>(node: ReactNode, partDefinitions: T, option?: Readonly<Partial<IReactTestEngineOption>>): TestEngine<T>; /** * Create test engine for React 18 or later, for React 17 or before, use createRenderedLegacyTestEngine * This function takes an html element purportedly rendered by React and create a test engine for it, it * can be useful in environment such as Storybook where Storybook renders the component and the test * @param rootElement The React node to render * @param partDefinitions The scene part definitions * @param option * @returns The test engine */ declare function createRenderedTestEngine<T extends ScenePart>(rootElement: HTMLElement, partDefinitions: T, _option?: Readonly<Partial<IReactTestEngineOption>>): TestEngine<T>; //#endregion export { IReactTestEngineOption, createRenderedTestEngine, createTestEngine }; //# sourceMappingURL=index.d.ts.map