@quilted/react-testing
Advanced tools
Comparing version 0.0.4 to 0.0.5
/// <reference types="react" /> | ||
import { VNode, Component } from 'preact'; | ||
import { isNode } from '../environment'; | ||
import type { CustomMount } from '../environment'; | ||
import type { Node, HtmlNodeExtensions } from '../types'; | ||
export { isNode }; | ||
export type { Node, HtmlNodeExtensions }; | ||
export type { Node, HtmlNodeExtensions, CustomMount }; | ||
declare const mount: <Props>(element: import("react").ReactElement<Props, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>) => import("../types").NodeApi<Props, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<Props, undefined>, createMount: <MountOptions extends object = {}, Context_1 extends object = {}, Async extends boolean = false>({ render, context: createContext, afterMount, }: { | ||
@@ -13,3 +14,3 @@ render(element: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>, context: Context_1, options: MountOptions): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>; | ||
afterMount?(wrapper: import("../types").NodeApi<unknown, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<unknown, Context_1>, options: MountOptions): void; | ||
})) => import("../environment").CustomMount<MountOptions, Context_1, HtmlNodeExtensions, Async>, mounted: Set<import("../types").NodeApi<any, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<any, any>>, unmountAll: () => void; | ||
})) => CustomMount<MountOptions, Context_1, HtmlNodeExtensions, Async>, mounted: Set<import("../types").NodeApi<any, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<any, any>>, unmountAll: () => void; | ||
export { mount, createMount, mounted, unmountAll }; | ||
@@ -16,0 +17,0 @@ /** |
/// <reference types="react" /> | ||
import { Environment, isNode } from '../environment'; | ||
import type { CustomMount } from '../environment'; | ||
import type { Node, HtmlNodeExtensions } from '../types'; | ||
export { isNode }; | ||
export type { Node, HtmlNodeExtensions }; | ||
export type { Node, HtmlNodeExtensions, CustomMount }; | ||
declare const mount: <Props>(element: import("react").ReactElement<Props, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>) => import("../types").NodeApi<Props, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<Props, undefined>, createMount: <MountOptions extends object = {}, Context_1 extends object = {}, Async extends boolean = false>({ render, context: createContext, afterMount, }: { | ||
@@ -12,3 +13,3 @@ render(element: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>, context: Context_1, options: MountOptions): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>; | ||
afterMount?(wrapper: import("../types").NodeApi<unknown, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<unknown, Context_1>, options: MountOptions): void; | ||
})) => import("../environment").CustomMount<MountOptions, Context_1, HtmlNodeExtensions, Async>, mounted: Set<import("../types").NodeApi<any, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<any, any>>, unmountAll: () => void; | ||
})) => CustomMount<MountOptions, Context_1, HtmlNodeExtensions, Async>, mounted: Set<import("../types").NodeApi<any, HtmlNodeExtensions> & Pick<HtmlNodeExtensions, "data" | "html" | "text" | "isDom" | "domNodes" | "domNode"> & import("../types").Root<any, any>>, unmountAll: () => void; | ||
export { mount, createMount, mounted, unmountAll }; | ||
@@ -15,0 +16,0 @@ declare type Create = Parameters<Environment<any, HtmlNodeExtensions>['update']>[1]; |
/// <reference types="react" /> | ||
import { isNode } from '../environment'; | ||
import type { CustomMount } from '../environment'; | ||
import type { Node } from '../types'; | ||
export { isNode }; | ||
export type { Node }; | ||
export type { Node, CustomMount }; | ||
declare const mount: <Props>(element: import("react").ReactElement<Props, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>) => import("../types").NodeApi<Props, {}> & Pick<{}, never> & import("../types").Root<Props, undefined>, createMount: <MountOptions extends object = {}, Context_1 extends object = {}, Async extends boolean = false>({ render, context: createContext, afterMount, }: { | ||
@@ -12,4 +13,4 @@ render(element: import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>, context: Context_1, options: MountOptions): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => import("react").Component<any, any, any>)> | null) | (new (props: any) => import("react").Component<any, any, any>)>; | ||
afterMount?(wrapper: import("../types").NodeApi<unknown, {}> & Pick<{}, never> & import("../types").Root<unknown, Context_1>, options: MountOptions): void; | ||
})) => import("../environment").CustomMount<MountOptions, Context_1, {}, Async>, mounted: Set<import("../types").NodeApi<any, {}> & Pick<{}, never> & import("../types").Root<any, any>>, unmountAll: () => void; | ||
})) => CustomMount<MountOptions, Context_1, {}, Async>, mounted: Set<import("../types").NodeApi<any, {}> & Pick<{}, never> & import("../types").Root<any, any>>, unmountAll: () => void; | ||
export { mount, createMount, mounted, unmountAll }; | ||
//# sourceMappingURL=test-renderer.d.ts.map |
export * from './implementations/test-renderer'; | ||
export type { Node } from './types'; | ||
export type { CustomMount } from './environment'; | ||
//# sourceMappingURL=index.d.ts.map |
import type { ComponentType, Context as ReactContext } from 'react'; | ||
import type { Node, PropsFor } from '../types'; | ||
declare type PropsFromNode<T> = T extends Node<infer U, object> ? U : never; | ||
declare type PropsFromNode<T> = NonNullable<T> extends Node<infer U, {}> ? U : never; | ||
declare global { | ||
@@ -5,0 +5,0 @@ namespace jest { |
import React from 'react'; | ||
export declare type PropsFor<T extends string | React.ComponentType<any>> = T extends string ? T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : T extends React.ComponentType<any> ? React.ComponentPropsWithoutRef<T> : React.HTMLAttributes<T> : T extends React.ComponentType<any> ? React.ComponentPropsWithoutRef<T> : never; | ||
import type { ComponentType, ComponentPropsWithoutRef, HTMLAttributes } from 'react'; | ||
export declare type PropsFor<T extends string | ComponentType<any>> = T extends string ? T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : T extends ComponentType<any> ? ComponentPropsWithoutRef<T> : HTMLAttributes<T> : T extends ComponentType<any> ? ComponentPropsWithoutRef<T> : never; | ||
export declare type FunctionKeys<T> = { | ||
@@ -22,3 +23,3 @@ [K in keyof T]-?: NonNullable<T[K]> extends (...args: any[]) => any ? K : never; | ||
readonly props: Props; | ||
readonly type: string | React.ComponentType<any> | null; | ||
readonly type: string | ComponentType<any> | null; | ||
readonly instance: any; | ||
@@ -31,5 +32,5 @@ readonly children: (Node<unknown, Extensions> | string)[]; | ||
find<Type extends React.ComponentType<any> | string>(type: Type, props?: Partial<PropsFor<Type>>): Node<PropsFor<Type>, Extensions> | null; | ||
findAll<Type extends React.ComponentType<any> | string>(type: Type, props?: Partial<PropsFor<Type>>): Node<PropsFor<Type>, Extensions>[]; | ||
findWhere(predicate: Predicate<Extensions>): Node<unknown> | null; | ||
findAllWhere(predicate: Predicate<Extensions>): Node<unknown>[]; | ||
findAll<Type extends ComponentType<any> | string>(type: Type, props?: Partial<PropsFor<Type>>): Node<PropsFor<Type>, Extensions>[]; | ||
findWhere<Props = unknown>(predicate: Predicate<Extensions>): Node<Props, Extensions> | null; | ||
findAllWhere<Props = unknown>(predicate: Predicate<Extensions>): Node<Props, Extensions>[]; | ||
trigger<K extends FunctionKeys<Props>>(prop: K, ...args: DeepPartial<Parameters<Props[K]>>): MaybeFunctionReturnType<NonNullable<Props[K]>>; | ||
@@ -36,0 +37,0 @@ triggerKeypath<T = unknown>(keypath: string, ...args: unknown[]): T; |
{ | ||
"name": "@quilted/react-testing", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "", | ||
@@ -29,3 +29,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "4fb2163242a4f8b70be6cf05763cf815797f2247" | ||
"gitHead": "93aac01d723a1e5a89abed01352674bfbe91ed25" | ||
} |
@@ -6,2 +6,3 @@ import {h, VNode, ComponentChild, Component, render} from 'preact'; | ||
import {createEnvironment, isNode, Environment} from '../environment'; | ||
import type {CustomMount} from '../environment'; | ||
import type {Node, HtmlNodeExtensions} from '../types'; | ||
@@ -14,3 +15,3 @@ | ||
export {isNode}; | ||
export type {Node, HtmlNodeExtensions}; | ||
export type {Node, HtmlNodeExtensions, CustomMount}; | ||
@@ -17,0 +18,0 @@ const {mount, createMount, mounted, unmountAll} = createEnvironment< |
@@ -5,2 +5,3 @@ import {render, unmountComponentAtNode} from 'react-dom'; | ||
import {createEnvironment, Environment, isNode} from '../environment'; | ||
import type {CustomMount} from '../environment'; | ||
import type {Node, HtmlNodeExtensions} from '../types'; | ||
@@ -19,3 +20,3 @@ | ||
export {isNode}; | ||
export type {Node, HtmlNodeExtensions}; | ||
export type {Node, HtmlNodeExtensions, CustomMount}; | ||
@@ -22,0 +23,0 @@ const {mount, createMount, mounted, unmountAll} = createEnvironment< |
@@ -9,2 +9,3 @@ import { | ||
import {createEnvironment, Environment, isNode} from '../environment'; | ||
import type {CustomMount} from '../environment'; | ||
import type {Node} from '../types'; | ||
@@ -17,3 +18,3 @@ | ||
export {isNode}; | ||
export type {Node}; | ||
export type {Node, CustomMount}; | ||
@@ -20,0 +21,0 @@ const {mount, createMount, mounted, unmountAll} = createEnvironment<Context>({ |
export * from './implementations/test-renderer'; | ||
export type {Node} from './types'; | ||
export type {CustomMount} from './environment'; |
@@ -13,3 +13,3 @@ import type {ComponentType, Context as ReactContext} from 'react'; | ||
type PropsFromNode<T> = T extends Node<infer U, object> ? U : never; | ||
type PropsFromNode<T> = NonNullable<T> extends Node<infer U, {}> ? U : never; | ||
@@ -16,0 +16,0 @@ declare global { |
import React from 'react'; | ||
import type { | ||
ComponentType, | ||
ComponentPropsWithoutRef, | ||
HTMLAttributes, | ||
} from 'react'; | ||
export type PropsFor< | ||
T extends string | React.ComponentType<any> | ||
> = T extends string | ||
export type PropsFor<T extends string | ComponentType<any>> = T extends string | ||
? T extends keyof JSX.IntrinsicElements | ||
? JSX.IntrinsicElements[T] | ||
: T extends React.ComponentType<any> | ||
? React.ComponentPropsWithoutRef<T> | ||
: React.HTMLAttributes<T> | ||
: T extends React.ComponentType<any> | ||
? React.ComponentPropsWithoutRef<T> | ||
: T extends ComponentType<any> | ||
? ComponentPropsWithoutRef<T> | ||
: HTMLAttributes<T> | ||
: T extends ComponentType<any> | ||
? ComponentPropsWithoutRef<T> | ||
: never; | ||
@@ -51,3 +54,3 @@ | ||
readonly props: Props; | ||
readonly type: string | React.ComponentType<any> | null; | ||
readonly type: string | ComponentType<any> | null; | ||
readonly instance: any; | ||
@@ -70,8 +73,12 @@ readonly children: (Node<unknown, Extensions> | string)[]; | ||
): Node<PropsFor<Type>, Extensions> | null; | ||
findAll<Type extends React.ComponentType<any> | string>( | ||
findAll<Type extends ComponentType<any> | string>( | ||
type: Type, | ||
props?: Partial<PropsFor<Type>>, | ||
): Node<PropsFor<Type>, Extensions>[]; | ||
findWhere(predicate: Predicate<Extensions>): Node<unknown> | null; | ||
findAllWhere(predicate: Predicate<Extensions>): Node<unknown>[]; | ||
findWhere<Props = unknown>( | ||
predicate: Predicate<Extensions>, | ||
): Node<Props, Extensions> | null; | ||
findAllWhere<Props = unknown>( | ||
predicate: Predicate<Extensions>, | ||
): Node<Props, Extensions>[]; | ||
@@ -78,0 +85,0 @@ trigger<K extends FunctionKeys<Props>>( |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
563824
6235