@testing-library/react
Advanced tools
Comparing version 15.0.2 to 15.0.3
{ | ||
"name": "@testing-library/react", | ||
"version": "15.0.2", | ||
"version": "15.0.3", | ||
"description": "Simple and complete React DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
// TypeScript Version: 3.8 | ||
import * as ReactDOMClient from 'react-dom/client' | ||
import { | ||
@@ -46,6 +46,6 @@ queries, | ||
export interface RenderOptions< | ||
Q extends Queries = typeof queries, | ||
Container extends Element | DocumentFragment = HTMLElement, | ||
BaseElement extends Element | DocumentFragment = Container, | ||
export interface BaseRenderOptions< | ||
Q extends Queries, | ||
Container extends RendererableContainer | HydrateableContainer, | ||
BaseElement extends Element | DocumentFragment, | ||
> { | ||
@@ -97,2 +97,40 @@ /** | ||
type RendererableContainer = ReactDOMClient.Container | ||
type HydrateableContainer = Parameters<typeof ReactDOMClient['hydrateRoot']>[0] | ||
export interface ClientRenderOptions< | ||
Q extends Queries, | ||
Container extends Element | DocumentFragment, | ||
BaseElement extends Element | DocumentFragment = Container, | ||
> extends BaseRenderOptions<Q, Container, BaseElement> { | ||
/** | ||
* If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side | ||
* rendering and use ReactDOM.hydrate to mount your components. | ||
* | ||
* @see https://testing-library.com/docs/react-testing-library/api/#hydrate) | ||
*/ | ||
hydrate?: false | undefined | ||
} | ||
export interface HydrateOptions< | ||
Q extends Queries, | ||
Container extends Element | DocumentFragment, | ||
BaseElement extends Element | DocumentFragment = Container, | ||
> extends BaseRenderOptions<Q, Container, BaseElement> { | ||
/** | ||
* If `hydrate` is set to `true`, then it will render with `ReactDOM.hydrate`. This may be useful if you are using server-side | ||
* rendering and use ReactDOM.hydrate to mount your components. | ||
* | ||
* @see https://testing-library.com/docs/react-testing-library/api/#hydrate) | ||
*/ | ||
hydrate: true | ||
} | ||
export type RenderOptions< | ||
Q extends Queries = typeof queries, | ||
Container extends RendererableContainer | HydrateableContainer = HTMLElement, | ||
BaseElement extends Element | DocumentFragment = Container, | ||
> = | ||
| ClientRenderOptions<Q, Container, BaseElement> | ||
| HydrateOptions<Q, Container, BaseElement> | ||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> | ||
@@ -105,8 +143,16 @@ | ||
Q extends Queries = typeof queries, | ||
Container extends Element | DocumentFragment = HTMLElement, | ||
Container extends RendererableContainer = HTMLElement, | ||
BaseElement extends Element | DocumentFragment = Container, | ||
>( | ||
ui: React.ReactNode, | ||
options: RenderOptions<Q, Container, BaseElement>, | ||
options: ClientRenderOptions<Q, Container, BaseElement>, | ||
): RenderResult<Q, Container, BaseElement> | ||
export function render< | ||
Q extends Queries = typeof queries, | ||
Container extends HydrateableContainer = HTMLElement, | ||
BaseElement extends Element | DocumentFragment = Container, | ||
>( | ||
ui: React.ReactNode, | ||
options: HydrateOptions<Q, Container, BaseElement>, | ||
): RenderResult<Q, Container, BaseElement> | ||
export function render( | ||
@@ -113,0 +159,0 @@ ui: React.ReactNode, |
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
4301573
29198