UNPKG

enzyme-adapter-preact-pure

Version:

Enzyme adapter for Preact

21 lines (20 loc) 911 B
/** * Functions for rendering components using Preact v10 and converting the result * to a React Standard Tree (RST) format defined by Enzyme. * * Preact 10 stores details of the rendered elements on internal fields of * the VNodes. A reference to the vnode is stored in the root DOM element. * The rendered result is converted to RST by traversing these vnode references. */ import type { NodeType, RSTNodeChild, RSTNode } from 'enzyme'; import type { ComponentChild } from 'preact'; export declare function nodeTypeFromType(type: any): NodeType; /** * Convert a JSX element tree returned by Preact's `h` function into an RST * node. */ export declare function rstNodeFromElement(node: ComponentChild, preserveChildrenProp?: boolean): RSTNodeChild; /** * Convert the Preact components rendered into `container` into an RST node. */ export declare function getNode(container: HTMLElement): RSTNode;