enzyme-adapter-preact-pure
Version:
Enzyme adapter for Preact
29 lines (28 loc) • 977 B
TypeScript
import type { Component, VNode } from 'preact';
/**
* Additional properties added to Preact VNode elements by the adapter.
*/
export interface VNodeExtensions extends VNode {
originalType: Function;
}
/**
* Return the real component type of a component instance created by
* shallow rendering.
*/
export declare function getRealType(component: Component): Function | null;
/**
* Return true if a VNode has been modified to shallow-render.
*/
export declare function isShallowRendered(vnode: VNode): boolean;
/**
* Convert components in a VNode tree to shallow-render.
*/
export declare function shallowRenderVNodeTree(vnode: VNode): void;
/**
* Invoke `fn` with shallow rendering enabled in Preact.
*
* During the execution of `fn`, any function or class component elements
* created by Preact's `h` function will be modified to only render a placeholder
* instead of the real component.
*/
export declare function withShallowRendering(fn: () => any): void;