Skip to content

Commit

Permalink
Update react-test-renderer definitions. (#1699)
Browse files Browse the repository at this point in the history
* React-test-renderer definitions added.

* Create function now takes element insteadof component.
  • Loading branch information
alpcanaydin authored and gantoine committed Jan 4, 2018
1 parent e7dfb57 commit 95b3e05
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ type ReactTestInstance = {
type ReactTestRenderer = {
toJSON(): null | ReactTestRendererJSON,
toTree(): null | ReactTestRendererTree,
unmount(nextElement?: React$ElementType): void,
update(nextElement: React$ElementType): void,
unmount(nextElement?: React$Element<any>): void,
update(nextElement: React$Element<any>): void,
getInstance(): null | ReactTestInstance,
root: ReactTestInstance
};

type TestRendererOptions = {
createNodeMock(element: React$ElementType): any
createNodeMock(element: React$Element<any>): any
};

declare module "react-test-renderer" {
declare function create(
nextElement: React$ElementType,
nextElement: React$Element<any>,
options?: TestRendererOptions
): ReactTestRenderer;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import renderer from "react-test-renderer";
const Example = () => <div>Example</div>;

// Renderer
const wrapper = renderer.create(Example);
const wrapper = renderer.create(<Example />);
const { root } = wrapper;
const instance = wrapper.getInstance();

Expand Down

0 comments on commit 95b3e05

Please sign in to comment.