@types/react-dom 16.0.3 → 16.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
react-dom/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) Microsoft Corporation. All rights reserved.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE
1
+ MIT License
2
+
3
+ Copyright (c) Microsoft Corporation. All rights reserved.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE
react-dom/README.md CHANGED
@@ -5,10 +5,10 @@
5
5
  This package contains type definitions for React (react-dom) (http://facebook.github.io/react/).
6
6
 
7
7
  # Details
8
- Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom
8
+ Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/react-dom
9
9
 
10
10
  Additional Details
11
- * Last updated: Thu, 09 Nov 2017 09:57:15 GMT
11
+ * Last updated: Mon, 06 Aug 2018 21:55:26 GMT
12
12
  * Dependencies: react, node
13
13
  * Global values: ReactDOM, ReactDOMNodeStream, ReactDOMServer
14
14
 
react-dom/index.d.ts CHANGED
@@ -1,100 +1,100 @@
1
- // Type definitions for React (react-dom) 16.0
2
- // Project: http://facebook.github.io/react/
3
- // Definitions by: Asana <https://asana.com>
4
- // AssureSign <http://www.assuresign.com>
5
- // Microsoft <https://microsoft.com>
6
- // MartynasZilinskas <https://github.com/MartynasZilinskas>
7
- // Josh Rutherford <https://github.com/theruther4d>
8
- // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9
- // TypeScript Version: 2.3
10
-
11
- export as namespace ReactDOM;
12
-
13
- import {
14
- ReactInstance, Component, ComponentState,
15
- ReactElement, SFCElement, CElement,
16
- DOMAttributes, DOMElement, ReactNode, ReactPortal
17
- } from 'react';
18
-
19
- export function findDOMNode(instance: ReactInstance): Element;
20
- export function unmountComponentAtNode(container: Element): boolean;
21
-
22
- export function createPortal(children: ReactNode, container: Element): ReactPortal;
23
-
24
- export const version: string;
25
- export const render: Renderer;
26
- export const hydrate: Renderer;
27
-
28
- export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
29
- export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
30
- export function unstable_batchedUpdates(callback: () => any): void;
31
-
32
- export function unstable_renderSubtreeIntoContainer<T extends Element>(
33
- parentComponent: Component<any>,
34
- element: DOMElement<DOMAttributes<T>, T>,
35
- container: Element,
36
- callback?: (element: T) => any): T;
37
- export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
38
- parentComponent: Component<any>,
39
- element: CElement<P, T>,
40
- container: Element,
41
- callback?: (component: T) => any): T;
42
- export function unstable_renderSubtreeIntoContainer<P>(
43
- parentComponent: Component<any>,
44
- element: ReactElement<P>,
45
- container: Element,
46
- callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
47
-
48
- export interface Renderer {
49
- // Deprecated(render): The return value is deprecated.
50
- // In future releases the render function's return type will be void.
51
-
52
- <T extends Element>(
53
- element: DOMElement<DOMAttributes<T>, T>,
54
- container: Element | null,
55
- callback?: () => void
56
- ): T;
57
-
58
- (
59
- element: Array<DOMElement<DOMAttributes<any>, any>>,
60
- container: Element | null,
61
- callback?: () => void
62
- ): Element;
63
-
64
- (
65
- element: SFCElement<any> | Array<SFCElement<any>>,
66
- container: Element | null,
67
- callback?: () => void
68
- ): void;
69
-
70
- <P, T extends Component<P, ComponentState>>(
71
- element: CElement<P, T>,
72
- container: Element | null,
73
- callback?: () => void
74
- ): T;
75
-
76
- (
77
- element: Array<CElement<any, Component<any, ComponentState>>>,
78
- container: Element | null,
79
- callback?: () => void
80
- ): Component<any, ComponentState>;
81
-
82
- <P>(
83
- element: ReactElement<P>,
84
- container: Element | null,
85
- callback?: () => void
86
- ): Component<P, ComponentState> | Element | void;
87
-
88
- (
89
- element: Array<ReactElement<any>>,
90
- container: Element | null,
91
- callback?: () => void
92
- ): Component<any, ComponentState> | Element | void;
93
-
94
- (
95
- parentComponent: Component<any> | Array<Component<any>>,
96
- element: SFCElement<any>,
97
- container: Element,
98
- callback?: () => void
99
- ): void;
100
- }
1
+ // Type definitions for React (react-dom) 16.0
2
+ // Project: http://facebook.github.io/react/
3
+ // Definitions by: Asana <https://asana.com>
4
+ // AssureSign <http://www.assuresign.com>
5
+ // Microsoft <https://microsoft.com>
6
+ // MartynasZilinskas <https://github.com/MartynasZilinskas>
7
+ // Josh Rutherford <https://github.com/theruther4d>
8
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
9
+ // TypeScript Version: 2.8
10
+
11
+ export as namespace ReactDOM;
12
+
13
+ import {
14
+ ReactInstance, Component, ComponentState,
15
+ ReactElement, SFCElement, CElement,
16
+ DOMAttributes, DOMElement, ReactNode, ReactPortal
17
+ } from 'react';
18
+
19
+ export function findDOMNode(instance: ReactInstance): Element | null | Text;
20
+ export function unmountComponentAtNode(container: Element): boolean;
21
+
22
+ export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
23
+
24
+ export const version: string;
25
+ export const render: Renderer;
26
+ export const hydrate: Renderer;
27
+
28
+ export function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
29
+ export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
30
+ export function unstable_batchedUpdates(callback: () => any): void;
31
+
32
+ export function unstable_renderSubtreeIntoContainer<T extends Element>(
33
+ parentComponent: Component<any>,
34
+ element: DOMElement<DOMAttributes<T>, T>,
35
+ container: Element,
36
+ callback?: (element: T) => any): T;
37
+ export function unstable_renderSubtreeIntoContainer<P, T extends Component<P, ComponentState>>(
38
+ parentComponent: Component<any>,
39
+ element: CElement<P, T>,
40
+ container: Element,
41
+ callback?: (component: T) => any): T;
42
+ export function unstable_renderSubtreeIntoContainer<P>(
43
+ parentComponent: Component<any>,
44
+ element: ReactElement<P>,
45
+ container: Element,
46
+ callback?: (component?: Component<P, ComponentState> | Element) => any): Component<P, ComponentState> | Element | void;
47
+
48
+ export interface Renderer {
49
+ // Deprecated(render): The return value is deprecated.
50
+ // In future releases the render function's return type will be void.
51
+
52
+ <T extends Element>(
53
+ element: DOMElement<DOMAttributes<T>, T>,
54
+ container: Element | null,
55
+ callback?: () => void
56
+ ): T;
57
+
58
+ (
59
+ element: Array<DOMElement<DOMAttributes<any>, any>>,
60
+ container: Element | null,
61
+ callback?: () => void
62
+ ): Element;
63
+
64
+ (
65
+ element: SFCElement<any> | Array<SFCElement<any>>,
66
+ container: Element | null,
67
+ callback?: () => void
68
+ ): void;
69
+
70
+ <P, T extends Component<P, ComponentState>>(
71
+ element: CElement<P, T>,
72
+ container: Element | null,
73
+ callback?: () => void
74
+ ): T;
75
+
76
+ (
77
+ element: Array<CElement<any, Component<any, ComponentState>>>,
78
+ container: Element | null,
79
+ callback?: () => void
80
+ ): Component<any, ComponentState>;
81
+
82
+ <P>(
83
+ element: ReactElement<P>,
84
+ container: Element | null,
85
+ callback?: () => void
86
+ ): Component<P, ComponentState> | Element | void;
87
+
88
+ (
89
+ element: Array<ReactElement<any>>,
90
+ container: Element | null,
91
+ callback?: () => void
92
+ ): Component<any, ComponentState> | Element | void;
93
+
94
+ (
95
+ parentComponent: Component<any> | Array<Component<any>>,
96
+ element: SFCElement<any>,
97
+ container: Element,
98
+ callback?: () => void
99
+ ): void;
100
+ }
@@ -1,18 +1,18 @@
1
- import { ReactElement } from 'react';
2
-
3
- /**
4
- * Render a ReactElement to its initial HTML. This should only be used on the
5
- * server.
6
- * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostream
7
- */
8
- export function renderToStream(element: ReactElement<any>): any;
9
-
10
- /**
11
- * Similar to renderToStream, except this doesn't create extra DOM attributes
12
- * such as data-react-id that React uses internally.
13
- * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticstream
14
- */
15
- export function renderToStaticStream(element: ReactElement<any>): any;
16
- export const version: string;
17
-
18
- export as namespace ReactDOMNodeStream;
1
+ import { ReactElement } from 'react';
2
+
3
+ /**
4
+ * Render a ReactElement to its initial HTML. This should only be used on the
5
+ * server.
6
+ * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostream
7
+ */
8
+ export function renderToStream(element: ReactElement<any>): any;
9
+
10
+ /**
11
+ * Similar to renderToStream, except this doesn't create extra DOM attributes
12
+ * such as data-react-id that React uses internally.
13
+ * See https://facebook.github.io/react/docs/react-dom-stream.html#rendertostaticstream
14
+ */
15
+ export function renderToStaticStream(element: ReactElement<any>): any;
16
+ export const version: string;
17
+
18
+ export as namespace ReactDOMNodeStream;
react-dom/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@types/react-dom",
3
- "version": "16.0.3",
3
+ "version": "16.0.7",
4
4
  "description": "TypeScript definitions for React (react-dom)",
5
5
  "license": "MIT",
6
6
  "contributors": [
@@ -30,13 +30,13 @@
30
30
  "main": "",
31
31
  "repository": {
32
32
  "type": "git",
33
- "url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
33
+ "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git"
34
34
  },
35
35
  "scripts": {},
36
36
  "dependencies": {
37
37
  "@types/react": "*",
38
38
  "@types/node": "*"
39
39
  },
40
- "typesPublisherContentHash": "a1ecd70c2ef3dbfad1349e2130eeab861b8b53a24ba36a0721a3bd23b9504aeb",
41
- "typeScriptVersion": "2.3"
40
+ "typesPublisherContentHash": "a72fcd94e060e36ee9396fe5c65569f1b87e6c64cce5d2d3461e86fa4b3a865d",
41
+ "typeScriptVersion": "2.8"
42
42
  }
@@ -1,41 +1,41 @@
1
- /// <reference types="node" />
2
-
3
- import { ReactElement } from 'react';
4
-
5
- /**
6
- * Render a React element to its initial HTML. This should only be used on the server.
7
- * React will return an HTML string. You can use this method to generate HTML on the server
8
- * and send the markup down on the initial request for faster page loads and to allow search
9
- * engines to crawl your pages for SEO purposes.
10
- *
11
- * If you call `ReactDOM.render()` on a node that already has this server-rendered markup,
12
- * React will preserve it and only attach event handlers, allowing you
13
- * to have a very performant first-load experience.
14
- */
15
- export function renderToString(element: ReactElement<any>): string;
16
-
17
- /**
18
- * Render a React element to its initial HTML. Returns a Readable stream that outputs
19
- * an HTML string. The HTML output by this stream is exactly equal to what
20
- * `ReactDOMServer.renderToString()` would return.
21
- */
22
- export function renderToNodeStream(element: ReactElement<any>): NodeJS.ReadableStream;
23
-
24
- /**
25
- * Similar to `renderToString`, except this doesn't create extra DOM attributes
26
- * such as `data-reactid`, that React uses internally. This is useful if you want
27
- * to use React as a simple static page generator, as stripping away the extra
28
- * attributes can save lots of bytes.
29
- */
30
- export function renderToStaticMarkup(element: ReactElement<any>): string;
31
-
32
- /**
33
- * Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
34
- * such as `data-reactid`, that React uses internally. The HTML output by this stream
35
- * is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
36
- */
37
- export function renderToStaticNodeStream(element: ReactElement<any>): NodeJS.ReadableStream;
38
-
39
- export const version: string;
40
-
41
- export as namespace ReactDOMServer;
1
+ /// <reference types="node" />
2
+
3
+ import { ReactElement } from 'react';
4
+
5
+ /**
6
+ * Render a React element to its initial HTML. This should only be used on the server.
7
+ * React will return an HTML string. You can use this method to generate HTML on the server
8
+ * and send the markup down on the initial request for faster page loads and to allow search
9
+ * engines to crawl your pages for SEO purposes.
10
+ *
11
+ * If you call `ReactDOM.render()` on a node that already has this server-rendered markup,
12
+ * React will preserve it and only attach event handlers, allowing you
13
+ * to have a very performant first-load experience.
14
+ */
15
+ export function renderToString(element: ReactElement<any>): string;
16
+
17
+ /**
18
+ * Render a React element to its initial HTML. Returns a Readable stream that outputs
19
+ * an HTML string. The HTML output by this stream is exactly equal to what
20
+ * `ReactDOMServer.renderToString()` would return.
21
+ */
22
+ export function renderToNodeStream(element: ReactElement<any>): NodeJS.ReadableStream;
23
+
24
+ /**
25
+ * Similar to `renderToString`, except this doesn't create extra DOM attributes
26
+ * such as `data-reactid`, that React uses internally. This is useful if you want
27
+ * to use React as a simple static page generator, as stripping away the extra
28
+ * attributes can save lots of bytes.
29
+ */
30
+ export function renderToStaticMarkup(element: ReactElement<any>): string;
31
+
32
+ /**
33
+ * Similar to `renderToNodeStream`, except this doesn't create extra DOM attributes
34
+ * such as `data-reactid`, that React uses internally. The HTML output by this stream
35
+ * is exactly equal to what `ReactDOMServer.renderToStaticMarkup()` would return.
36
+ */
37
+ export function renderToStaticNodeStream(element: ReactElement<any>): NodeJS.ReadableStream;
38
+
39
+ export const version: string;
40
+
41
+ export as namespace ReactDOMServer;
@@ -1,276 +1,276 @@
1
- import {
2
- AbstractView, Component, ComponentClass,
3
- ReactElement, ReactInstance, ClassType,
4
- DOMElement, SFCElement, CElement,
5
- ReactHTMLElement, DOMAttributes, SFC
6
- } from 'react';
7
-
8
- import * as ReactTestUtils from ".";
9
-
10
- export interface OptionalEventProperties {
11
- bubbles?: boolean;
12
- cancelable?: boolean;
13
- currentTarget?: EventTarget;
14
- defaultPrevented?: boolean;
15
- eventPhase?: number;
16
- isTrusted?: boolean;
17
- nativeEvent?: Event;
18
- preventDefault?(): void;
19
- stopPropagation?(): void;
20
- target?: EventTarget;
21
- timeStamp?: Date;
22
- type?: string;
23
- }
24
-
25
- export interface SyntheticEventData extends OptionalEventProperties {
26
- altKey?: boolean;
27
- button?: number;
28
- buttons?: number;
29
- clientX?: number;
30
- clientY?: number;
31
- changedTouches?: TouchList;
32
- charCode?: boolean;
33
- clipboardData?: DataTransfer;
34
- ctrlKey?: boolean;
35
- deltaMode?: number;
36
- deltaX?: number;
37
- deltaY?: number;
38
- deltaZ?: number;
39
- detail?: number;
40
- getModifierState?(key: string): boolean;
41
- key?: string;
42
- keyCode?: number;
43
- locale?: string;
44
- location?: number;
45
- metaKey?: boolean;
46
- pageX?: number;
47
- pageY?: number;
48
- relatedTarget?: EventTarget;
49
- repeat?: boolean;
50
- screenX?: number;
51
- screenY?: number;
52
- shiftKey?: boolean;
53
- targetTouches?: TouchList;
54
- touches?: TouchList;
55
- view?: AbstractView;
56
- which?: number;
57
- }
58
-
59
- export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
60
-
61
- export interface MockedComponentClass {
62
- new (props: {}): any;
63
- }
64
-
65
- export interface ShallowRenderer {
66
- /**
67
- * After `shallowRenderer.render()` has been called, returns shallowly rendered output.
68
- */
69
- getRenderOutput<E extends ReactElement<any>>(): E;
70
- /**
71
- * After `shallowRenderer.render()` has been called, returns shallowly rendered output.
72
- */
73
- getRenderOutput(): ReactElement<any>;
74
- /**
75
- * Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep.
76
- */
77
- render(element: ReactElement<any>, context?: any): void;
78
- unmount(): void;
79
- }
80
-
81
- /**
82
- * Simulate an event dispatch on a DOM node with optional `eventData` event data.
83
- * `Simulate` has a method for every event that React understands.
84
- */
85
- export namespace Simulate {
86
- const abort: EventSimulator;
87
- const animationEnd: EventSimulator;
88
- const animationIteration: EventSimulator;
89
- const animationStart: EventSimulator;
90
- const blur: EventSimulator;
91
- const canPlay: EventSimulator;
92
- const canPlayThrough: EventSimulator;
93
- const change: EventSimulator;
94
- const click: EventSimulator;
95
- const compositionEnd: EventSimulator;
96
- const compositionStart: EventSimulator;
97
- const compositionUpdate: EventSimulator;
98
- const contextMenu: EventSimulator;
99
- const copy: EventSimulator;
100
- const cut: EventSimulator;
101
- const doubleClick: EventSimulator;
102
- const drag: EventSimulator;
103
- const dragEnd: EventSimulator;
104
- const dragEnter: EventSimulator;
105
- const dragExit: EventSimulator;
106
- const dragLeave: EventSimulator;
107
- const dragOver: EventSimulator;
108
- const dragStart: EventSimulator;
109
- const drop: EventSimulator;
110
- const durationChange: EventSimulator;
111
- const emptied: EventSimulator;
112
- const encrypted: EventSimulator;
113
- const ended: EventSimulator;
114
- const error: EventSimulator;
115
- const focus: EventSimulator;
116
- const input: EventSimulator;
117
- const invalid: EventSimulator;
118
- const keyDown: EventSimulator;
119
- const keyPress: EventSimulator;
120
- const keyUp: EventSimulator;
121
- const load: EventSimulator;
122
- const loadStart: EventSimulator;
123
- const loadedData: EventSimulator;
124
- const loadedMetadata: EventSimulator;
125
- const mouseDown: EventSimulator;
126
- const mouseEnter: EventSimulator;
127
- const mouseLeave: EventSimulator;
128
- const mouseMove: EventSimulator;
129
- const mouseOut: EventSimulator;
130
- const mouseOver: EventSimulator;
131
- const mouseUp: EventSimulator;
132
- const paste: EventSimulator;
133
- const pause: EventSimulator;
134
- const play: EventSimulator;
135
- const playing: EventSimulator;
136
- const progress: EventSimulator;
137
- const rateChange: EventSimulator;
138
- const scroll: EventSimulator;
139
- const seeked: EventSimulator;
140
- const seeking: EventSimulator;
141
- const select: EventSimulator;
142
- const stalled: EventSimulator;
143
- const submit: EventSimulator;
144
- const suspend: EventSimulator;
145
- const timeUpdate: EventSimulator;
146
- const touchCancel: EventSimulator;
147
- const touchEnd: EventSimulator;
148
- const touchMove: EventSimulator;
149
- const touchStart: EventSimulator;
150
- const transitionEnd: EventSimulator;
151
- const volumeChange: EventSimulator;
152
- const waiting: EventSimulator;
153
- const wheel: EventSimulator;
154
- }
155
-
156
- /**
157
- * Render a React element into a detached DOM node in the document. __This function requires a DOM__.
158
- */
159
- export function renderIntoDocument<T extends Element>(
160
- element: DOMElement<any, T>): T;
161
- export function renderIntoDocument(
162
- element: SFCElement<any>): void;
163
- export function renderIntoDocument<T extends Component<any>>(
164
- element: CElement<any, T>): T;
165
- export function renderIntoDocument<P>(
166
- element: ReactElement<P>): Component<P> | Element | void;
167
-
168
- /**
169
- * Pass a mocked component module to this method to augment it with useful methods that allow it to
170
- * be used as a dummy React component. Instead of rendering as usual, the component will become
171
- * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
172
- */
173
- export function mockComponent(
174
- mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
175
-
176
- /**
177
- * Returns `true` if `element` is any React element.
178
- */
179
- export function isElement(element: any): boolean;
180
-
181
- /**
182
- * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
183
- */
184
- export function isElementOfType<T extends HTMLElement>(
185
- element: ReactElement<any>, type: string): element is ReactHTMLElement<T>;
186
- /**
187
- * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
188
- */
189
- export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
190
- element: ReactElement<any>, type: string): element is DOMElement<P, T>;
191
- /**
192
- * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
193
- */
194
- export function isElementOfType<P>(
195
- element: ReactElement<any>, type: SFC<P>): element is SFCElement<P>;
196
- /**
197
- * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
198
- */
199
- export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
200
- element: ReactElement<any>, type: ClassType<P, T, C>): element is CElement<P, T>;
201
-
202
- /**
203
- * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
204
- */
205
- export function isDOMComponent(instance: ReactInstance): instance is Element;
206
- /**
207
- * Returns `true` if `instance` is a user-defined component, such as a class or a function.
208
- */
209
- export function isCompositeComponent(instance: ReactInstance): instance is Component<any>;
210
- /**
211
- * Returns `true` if `instance` is a component whose type is of a React `componentClass`.
212
- */
213
- export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
214
- instance: ReactInstance, type: ClassType<any, T, C>): boolean;
215
-
216
- /**
217
- * Traverse all components in `tree` and accumulate all components where
218
- * `test(component)` is `true`. This is not that useful on its own, but it's used
219
- * as a primitive for other test utils.
220
- */
221
- export function findAllInRenderedTree(
222
- root: Component<any>,
223
- fn: (i: ReactInstance) => boolean): ReactInstance[];
224
-
225
- /**
226
- * Finds all DOM elements of components in the rendered tree that are
227
- * DOM components with the class name matching `className`.
228
- */
229
- export function scryRenderedDOMComponentsWithClass(
230
- root: Component<any>,
231
- className: string): Element[];
232
- /**
233
- * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
234
- * and returns that one result, or throws exception if there is any other
235
- * number of matches besides one.
236
- */
237
- export function findRenderedDOMComponentWithClass(
238
- root: Component<any>,
239
- className: string): Element;
240
-
241
- /**
242
- * Finds all DOM elements of components in the rendered tree that are
243
- * DOM components with the tag name matching `tagName`.
244
- */
245
- export function scryRenderedDOMComponentsWithTag(
246
- root: Component<any>,
247
- tagName: string): Element[];
248
- /**
249
- * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
250
- * and returns that one result, or throws exception if there is any other
251
- * number of matches besides one.
252
- */
253
- export function findRenderedDOMComponentWithTag(
254
- root: Component<any>,
255
- tagName: string): Element;
256
-
257
- /**
258
- * Finds all instances of components with type equal to `componentClass`.
259
- */
260
- export function scryRenderedComponentsWithType<T extends Component, C extends ComponentClass>(
261
- root: Component<any>,
262
- type: ClassType<any, T, C>): T[];
263
-
264
- /**
265
- * Same as `scryRenderedComponentsWithType()` but expects there to be one result
266
- * and returns that one result, or throws exception if there is any other
267
- * number of matches besides one.
268
- */
269
- export function findRenderedComponentWithType<T extends Component, C extends ComponentClass>(
270
- root: Component<any>,
271
- type: ClassType<any, T, C>): T;
272
-
273
- /**
274
- * Call this in your tests to create a shallow renderer.
275
- */
276
- export function createRenderer(): ShallowRenderer;
1
+ import {
2
+ AbstractView, Component, ComponentClass,
3
+ ReactElement, ReactInstance, ClassType,
4
+ DOMElement, SFCElement, CElement,
5
+ ReactHTMLElement, DOMAttributes, SFC
6
+ } from 'react';
7
+
8
+ import * as ReactTestUtils from ".";
9
+
10
+ export interface OptionalEventProperties {
11
+ bubbles?: boolean;
12
+ cancelable?: boolean;
13
+ currentTarget?: EventTarget;
14
+ defaultPrevented?: boolean;
15
+ eventPhase?: number;
16
+ isTrusted?: boolean;
17
+ nativeEvent?: Event;
18
+ preventDefault?(): void;
19
+ stopPropagation?(): void;
20
+ target?: EventTarget;
21
+ timeStamp?: Date;
22
+ type?: string;
23
+ }
24
+
25
+ export interface SyntheticEventData extends OptionalEventProperties {
26
+ altKey?: boolean;
27
+ button?: number;
28
+ buttons?: number;
29
+ clientX?: number;
30
+ clientY?: number;
31
+ changedTouches?: TouchList;
32
+ charCode?: boolean;
33
+ clipboardData?: DataTransfer;
34
+ ctrlKey?: boolean;
35
+ deltaMode?: number;
36
+ deltaX?: number;
37
+ deltaY?: number;
38
+ deltaZ?: number;
39
+ detail?: number;
40
+ getModifierState?(key: string): boolean;
41
+ key?: string;
42
+ keyCode?: number;
43
+ locale?: string;
44
+ location?: number;
45
+ metaKey?: boolean;
46
+ pageX?: number;
47
+ pageY?: number;
48
+ relatedTarget?: EventTarget;
49
+ repeat?: boolean;
50
+ screenX?: number;
51
+ screenY?: number;
52
+ shiftKey?: boolean;
53
+ targetTouches?: TouchList;
54
+ touches?: TouchList;
55
+ view?: AbstractView;
56
+ which?: number;
57
+ }
58
+
59
+ export type EventSimulator = (element: Element | Component<any>, eventData?: SyntheticEventData) => void;
60
+
61
+ export interface MockedComponentClass {
62
+ new (props: {}): any;
63
+ }
64
+
65
+ export interface ShallowRenderer {
66
+ /**
67
+ * After `shallowRenderer.render()` has been called, returns shallowly rendered output.
68
+ */
69
+ getRenderOutput<E extends ReactElement<any>>(): E;
70
+ /**
71
+ * After `shallowRenderer.render()` has been called, returns shallowly rendered output.
72
+ */
73
+ getRenderOutput(): ReactElement<any>;
74
+ /**
75
+ * Similar to `ReactDOM.render` but it doesn't require DOM and only renders a single level deep.
76
+ */
77
+ render(element: ReactElement<any>, context?: any): void;
78
+ unmount(): void;
79
+ }
80
+
81
+ /**
82
+ * Simulate an event dispatch on a DOM node with optional `eventData` event data.
83
+ * `Simulate` has a method for every event that React understands.
84
+ */
85
+ export namespace Simulate {
86
+ const abort: EventSimulator;
87
+ const animationEnd: EventSimulator;
88
+ const animationIteration: EventSimulator;
89
+ const animationStart: EventSimulator;
90
+ const blur: EventSimulator;
91
+ const canPlay: EventSimulator;
92
+ const canPlayThrough: EventSimulator;
93
+ const change: EventSimulator;
94
+ const click: EventSimulator;
95
+ const compositionEnd: EventSimulator;
96
+ const compositionStart: EventSimulator;
97
+ const compositionUpdate: EventSimulator;
98
+ const contextMenu: EventSimulator;
99
+ const copy: EventSimulator;
100
+ const cut: EventSimulator;
101
+ const doubleClick: EventSimulator;
102
+ const drag: EventSimulator;
103
+ const dragEnd: EventSimulator;
104
+ const dragEnter: EventSimulator;
105
+ const dragExit: EventSimulator;
106
+ const dragLeave: EventSimulator;
107
+ const dragOver: EventSimulator;
108
+ const dragStart: EventSimulator;
109
+ const drop: EventSimulator;
110
+ const durationChange: EventSimulator;
111
+ const emptied: EventSimulator;
112
+ const encrypted: EventSimulator;
113
+ const ended: EventSimulator;
114
+ const error: EventSimulator;
115
+ const focus: EventSimulator;
116
+ const input: EventSimulator;
117
+ const invalid: EventSimulator;
118
+ const keyDown: EventSimulator;
119
+ const keyPress: EventSimulator;
120
+ const keyUp: EventSimulator;
121
+ const load: EventSimulator;
122
+ const loadStart: EventSimulator;
123
+ const loadedData: EventSimulator;
124
+ const loadedMetadata: EventSimulator;
125
+ const mouseDown: EventSimulator;
126
+ const mouseEnter: EventSimulator;
127
+ const mouseLeave: EventSimulator;
128
+ const mouseMove: EventSimulator;
129
+ const mouseOut: EventSimulator;
130
+ const mouseOver: EventSimulator;
131
+ const mouseUp: EventSimulator;
132
+ const paste: EventSimulator;
133
+ const pause: EventSimulator;
134
+ const play: EventSimulator;
135
+ const playing: EventSimulator;
136
+ const progress: EventSimulator;
137
+ const rateChange: EventSimulator;
138
+ const scroll: EventSimulator;
139
+ const seeked: EventSimulator;
140
+ const seeking: EventSimulator;
141
+ const select: EventSimulator;
142
+ const stalled: EventSimulator;
143
+ const submit: EventSimulator;
144
+ const suspend: EventSimulator;
145
+ const timeUpdate: EventSimulator;
146
+ const touchCancel: EventSimulator;
147
+ const touchEnd: EventSimulator;
148
+ const touchMove: EventSimulator;
149
+ const touchStart: EventSimulator;
150
+ const transitionEnd: EventSimulator;
151
+ const volumeChange: EventSimulator;
152
+ const waiting: EventSimulator;
153
+ const wheel: EventSimulator;
154
+ }
155
+
156
+ /**
157
+ * Render a React element into a detached DOM node in the document. __This function requires a DOM__.
158
+ */
159
+ export function renderIntoDocument<T extends Element>(
160
+ element: DOMElement<any, T>): T;
161
+ export function renderIntoDocument(
162
+ element: SFCElement<any>): void;
163
+ export function renderIntoDocument<T extends Component<any>>(
164
+ element: CElement<any, T>): T;
165
+ export function renderIntoDocument<P>(
166
+ element: ReactElement<P>): Component<P> | Element | void;
167
+
168
+ /**
169
+ * Pass a mocked component module to this method to augment it with useful methods that allow it to
170
+ * be used as a dummy React component. Instead of rendering as usual, the component will become
171
+ * a simple `<div>` (or other tag if `mockTagName` is provided) containing any provided children.
172
+ */
173
+ export function mockComponent(
174
+ mocked: MockedComponentClass, mockTagName?: string): typeof ReactTestUtils;
175
+
176
+ /**
177
+ * Returns `true` if `element` is any React element.
178
+ */
179
+ export function isElement(element: any): boolean;
180
+
181
+ /**
182
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
183
+ */
184
+ export function isElementOfType<T extends HTMLElement>(
185
+ element: ReactElement<any>, type: string): element is ReactHTMLElement<T>;
186
+ /**
187
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
188
+ */
189
+ export function isElementOfType<P extends DOMAttributes<{}>, T extends Element>(
190
+ element: ReactElement<any>, type: string): element is DOMElement<P, T>;
191
+ /**
192
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
193
+ */
194
+ export function isElementOfType<P>(
195
+ element: ReactElement<any>, type: SFC<P>): element is SFCElement<P>;
196
+ /**
197
+ * Returns `true` if `element` is a React element whose type is of a React `componentClass`.
198
+ */
199
+ export function isElementOfType<P, T extends Component<P>, C extends ComponentClass<P>>(
200
+ element: ReactElement<any>, type: ClassType<P, T, C>): element is CElement<P, T>;
201
+
202
+ /**
203
+ * Returns `true` if `instance` is a DOM component (such as a `<div>` or `<span>`).
204
+ */
205
+ export function isDOMComponent(instance: ReactInstance): instance is Element;
206
+ /**
207
+ * Returns `true` if `instance` is a user-defined component, such as a class or a function.
208
+ */
209
+ export function isCompositeComponent(instance: ReactInstance): instance is Component<any>;
210
+ /**
211
+ * Returns `true` if `instance` is a component whose type is of a React `componentClass`.
212
+ */
213
+ export function isCompositeComponentWithType<T extends Component<any>, C extends ComponentClass<any>>(
214
+ instance: ReactInstance, type: ClassType<any, T, C>): boolean;
215
+
216
+ /**
217
+ * Traverse all components in `tree` and accumulate all components where
218
+ * `test(component)` is `true`. This is not that useful on its own, but it's used
219
+ * as a primitive for other test utils.
220
+ */
221
+ export function findAllInRenderedTree(
222
+ root: Component<any>,
223
+ fn: (i: ReactInstance) => boolean): ReactInstance[];
224
+
225
+ /**
226
+ * Finds all DOM elements of components in the rendered tree that are
227
+ * DOM components with the class name matching `className`.
228
+ */
229
+ export function scryRenderedDOMComponentsWithClass(
230
+ root: Component<any>,
231
+ className: string): Element[];
232
+ /**
233
+ * Like `scryRenderedDOMComponentsWithClass()` but expects there to be one result,
234
+ * and returns that one result, or throws exception if there is any other
235
+ * number of matches besides one.
236
+ */
237
+ export function findRenderedDOMComponentWithClass(
238
+ root: Component<any>,
239
+ className: string): Element;
240
+
241
+ /**
242
+ * Finds all DOM elements of components in the rendered tree that are
243
+ * DOM components with the tag name matching `tagName`.
244
+ */
245
+ export function scryRenderedDOMComponentsWithTag(
246
+ root: Component<any>,
247
+ tagName: string): Element[];
248
+ /**
249
+ * Like `scryRenderedDOMComponentsWithTag()` but expects there to be one result,
250
+ * and returns that one result, or throws exception if there is any other
251
+ * number of matches besides one.
252
+ */
253
+ export function findRenderedDOMComponentWithTag(
254
+ root: Component<any>,
255
+ tagName: string): Element;
256
+
257
+ /**
258
+ * Finds all instances of components with type equal to `componentClass`.
259
+ */
260
+ export function scryRenderedComponentsWithType<T extends Component, C extends ComponentClass>(
261
+ root: Component<any>,
262
+ type: ClassType<any, T, C>): T[];
263
+
264
+ /**
265
+ * Same as `scryRenderedComponentsWithType()` but expects there to be one result
266
+ * and returns that one result, or throws exception if there is any other
267
+ * number of matches besides one.
268
+ */
269
+ export function findRenderedComponentWithType<T extends Component, C extends ComponentClass>(
270
+ root: Component<any>,
271
+ type: ClassType<any, T, C>): T;
272
+
273
+ /**
274
+ * Call this in your tests to create a shallow renderer.
275
+ */
276
+ export function createRenderer(): ShallowRenderer;