react-testing-library
Advanced tools
Comparing version
{ | ||
"name": "react-testing-library", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"description": "Simple and complete React DOM testing utilities that encourage good testing practices.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -1,81 +0,7 @@ | ||
import {Simulate as ReactSimulate} from 'react-dom/test-utils' | ||
import { | ||
AllByAttribute, | ||
AllByText, | ||
BoundFunction, | ||
GetByAttribute, | ||
GetByText, | ||
QueryByAttribute, | ||
QueryByText, | ||
} from 'dom-testing-library' | ||
export {prettyDOM} from 'dom-testing-library' | ||
import {getQueriesForElement} from 'dom-testing-library' | ||
type TextMatchFunction = (content: string, element: HTMLElement) => boolean | ||
type TextMatch = string | RegExp | TextMatchFunction | ||
type TextMatchOptions = { | ||
exact?: boolean | ||
trim?: boolean | ||
collapseWhitespace?: boolean | ||
} | ||
export * from 'dom-testing-library' | ||
interface GetsAndQueries { | ||
queryByPlaceholderText: BoundFunction<QueryByAttribute> | ||
queryAllByPlaceholderText: BoundFunction<AllByAttribute> | ||
getByPlaceholderText: BoundFunction<GetByAttribute> | ||
getAllByPlaceholderText: BoundFunction<AllByAttribute> | ||
queryByText: BoundFunction<QueryByText> | ||
queryAllByText: BoundFunction<AllByText> | ||
getByText: BoundFunction<GetByText> | ||
getAllByText: BoundFunction<AllByText> | ||
queryByLabelText: BoundFunction<QueryByText> | ||
queryAllByLabelText: BoundFunction<AllByText> | ||
getByLabelText: BoundFunction<GetByText> | ||
getAllByLabelText: BoundFunction<AllByText> | ||
queryByAltText: BoundFunction<QueryByAttribute> | ||
queryAllByAltText: BoundFunction<AllByAttribute> | ||
getByAltText: BoundFunction<GetByAttribute> | ||
getAllByAltText: BoundFunction<AllByAttribute> | ||
queryByTestId: BoundFunction<QueryByAttribute> | ||
queryAllByTestId: BoundFunction<AllByAttribute> | ||
getByTestId: BoundFunction<GetByAttribute> | ||
getAllByTestId: BoundFunction<AllByAttribute> | ||
queryByTitle: BoundFunction<QueryByAttribute> | ||
queryAllByTitle: BoundFunction<AllByAttribute> | ||
getByTitle: BoundFunction<GetByAttribute> | ||
getAllByTitle: BoundFunction<AllByAttribute> | ||
queryByValue: BoundFunction<QueryByAttribute> | ||
queryAllByValue: BoundFunction<AllByAttribute> | ||
getByValue: BoundFunction<GetByAttribute> | ||
getAllByValue: BoundFunction<AllByAttribute> | ||
} | ||
type GetsAndQueries = ReturnType<typeof getQueriesForElement> | ||
export const queryByPlaceholderText: QueryByAttribute | ||
export const queryAllByPlaceholderText: AllByAttribute | ||
export const getByPlaceholderText: GetByAttribute | ||
export const getAllByPlaceholderText: AllByAttribute | ||
export const queryByText: QueryByText | ||
export const queryAllByText: AllByText | ||
export const getByText: GetByText | ||
export const getAllByText: AllByText | ||
export const queryByLabelText: QueryByText | ||
export const queryAllByLabelText: AllByText | ||
export const getByLabelText: GetByText | ||
export const getAllByLabelText: AllByText | ||
export const queryByAltText: QueryByAttribute | ||
export const queryAllByAltText: AllByAttribute | ||
export const getByAltText: GetByAttribute | ||
export const getAllByAltText: AllByAttribute | ||
export const queryByTestId: QueryByAttribute | ||
export const queryAllByTestId: AllByAttribute | ||
export const getByTestId: GetByAttribute | ||
export const getAllByTestId: AllByAttribute | ||
export const queryByTitle: QueryByAttribute | ||
export const queryAllByTitle: AllByAttribute | ||
export const getByTitle: GetByAttribute | ||
export const getAllByTitle: AllByAttribute | ||
export const queryByValue: QueryByAttribute | ||
export const queryAllByValue: AllByAttribute | ||
export const getByValue: GetByAttribute | ||
export const getAllByValue: AllByAttribute | ||
export interface RenderResult extends GetsAndQueries { | ||
@@ -85,3 +11,3 @@ container: HTMLDivElement | ||
rerender: (ui: React.ReactElement<any>) => void | ||
unmount: VoidFunction | ||
unmount: () => boolean | ||
} | ||
@@ -98,110 +24,4 @@ | ||
/** | ||
* When in need to wait for DOM elements to appear, disappear, or change. Prefer waitForElement. | ||
*/ | ||
export function wait( | ||
callback?: () => void, | ||
options?: { | ||
timeout?: number | ||
interval?: number | ||
}, | ||
): Promise<void> | ||
/** | ||
* When in need to wait for DOM elements to appear, disappear, or change. | ||
*/ | ||
export function waitForElement<T>( | ||
callback?: () => T, | ||
options?: { | ||
container?: HTMLElement | ||
timeout?: number | ||
mutationObserverOptions?: MutationObserverInit | ||
}, | ||
): Promise<T | undefined> | ||
type EventType = | ||
| 'copy' | ||
| 'cut' | ||
| 'paste' | ||
| 'compositionEnd' | ||
| 'compositionStart' | ||
| 'compositionUpdate' | ||
| 'keyDown' | ||
| 'keyPress' | ||
| 'keyUp' | ||
| 'focus' | ||
| 'blur' | ||
| 'change' | ||
| 'input' | ||
| 'invalid' | ||
| 'submit' | ||
| 'click' | ||
| 'contextMenu' | ||
| 'dblClick' | ||
| 'drag' | ||
| 'dragEnd' | ||
| 'dragEnter' | ||
| 'dragExit' | ||
| 'dragLeave' | ||
| 'dragOver' | ||
| 'dragStart' | ||
| 'drop' | ||
| 'mouseDown' | ||
| 'mouseEnter' | ||
| 'mouseLeave' | ||
| 'mouseMove' | ||
| 'mouseOut' | ||
| 'mouseOver' | ||
| 'mouseUp' | ||
| 'select' | ||
| 'touchCancel' | ||
| 'touchEnd' | ||
| 'touchMove' | ||
| 'touchStart' | ||
| 'scroll' | ||
| 'wheel' | ||
| 'abort' | ||
| 'canPlay' | ||
| 'canPlayThrough' | ||
| 'durationChange' | ||
| 'emptied' | ||
| 'encrypted' | ||
| 'ended' | ||
| 'loadedData' | ||
| 'loadedMetadata' | ||
| 'loadStart' | ||
| 'pause' | ||
| 'play' | ||
| 'playing' | ||
| 'progress' | ||
| 'rateChange' | ||
| 'seeked' | ||
| 'seeking' | ||
| 'stalled' | ||
| 'suspend' | ||
| 'timeUpdate' | ||
| 'volumeChange' | ||
| 'waiting' | ||
| 'load' | ||
| 'error' | ||
| 'animationStart' | ||
| 'animationEnd' | ||
| 'animationIteration' | ||
| 'transitionEnd' | ||
| 'doubleClick' | ||
type FireFunction = (element: HTMLElement, event: Event) => boolean | ||
type FireObject = { | ||
[K in EventType]: (element: HTMLElement, options?: {}) => boolean | ||
} | ||
/** | ||
* Fire DOM events. | ||
*/ | ||
export const fireEvent: FireFunction & FireObject | ||
/** | ||
* Unmounts React trees that were mounted with render. | ||
*/ | ||
export function cleanup(): void | ||
export function getQueriesForElement(element: HTMLElement): GetsAndQueries |
58810
-7.59%95
-64.55%