enzyme-adapter-preact-pure
Version:
Enzyme adapter for Preact
29 lines (28 loc) • 1.52 kB
TypeScript
/**
* This file includes modified copies of the Preact source and custom
* implementations of Preact functions (e.g. setState) to perform a shallow
* render
*
* The Preact source is copyrighted to Jason Miller and licensed under the MIT
* License, found a the link below:
*
* https://github.com/preactjs/preact/blob/d4089df1263faab9b980a3493a4c7e986f254f8e/LICENSE
*/
import type { VNode as InternalVNode, Component as InternalComponentType } from 'preact/src/internal';
import type { ComponentVNode } from './PreactShallowRenderer';
/** Symbol to return if a component indicates it should not update */
export declare const skipUpdateSymbol: unique symbol;
/**
* Shallowly render a component. Much of this function is copied directly from
* the Preact 10 source. Differences to the original source are commented.
*/
export declare function diffComponent(newVNode: ComponentVNode, oldVNode: ComponentVNode, globalContext: any, commitQueue: InternalComponentType[]): any;
/**
* @param {Array<import('../internal').Component>} commitQueue List of components
* which have callbacks to invoke in commitRoot
* @param {import('../internal').VNode} root
*/
export declare function commitRoot(commitQueue: any[], root: ComponentVNode): void;
export declare function unmount(vnode: InternalVNode): void;
export declare function shallowSetState(this: InternalComponentType, update: any, callback: () => void): void;
export declare function shallowForceUpdate(this: InternalComponentType, callback: () => void): void;