Skip to content

Commit

Permalink
[Docs] mount: Updated docs for ReactWrapper.instance(); remove docs…
Browse files Browse the repository at this point in the history
… for v2's `getNode()`/`getNodes()`

Fixes #1669
  • Loading branch information
conor-cafferkey-sociomantic authored and ljharb committed Jun 1, 2018
1 parent 0ee548f commit 6767ce5
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 80 deletions.
32 changes: 0 additions & 32 deletions docs/api/ReactWrapper/getNode.md

This file was deleted.

32 changes: 0 additions & 32 deletions docs/api/ReactWrapper/getNodes.md

This file was deleted.

6 changes: 2 additions & 4 deletions docs/api/ReactWrapper/instance.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
# `.instance() => ReactComponent`

Gets the instance of the component being rendered as the root node passed into `mount()`.

NOTE: can only be called on a wrapper instance that is also the root instance.
Returns the wrapper's underlying instance.



#### Returns

`ReactComponent`: The component instance.
`ReactComponent|DOMComponent`: The retrieved instance.



Expand Down
10 changes: 2 additions & 8 deletions docs/api/mount.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,6 @@ Returns a static HTML rendering of the current node.
#### [`.get(index) => ReactElement`](ReactWrapper/get.md)
Returns the node at the provided index of the current wrapper.

#### [`.getNode() => ReactElement`](ReactWrapper/getNode.md)
Returns the wrapper's underlying node.

#### [`.getNodes() => Array<ReactElement>`](ReactWrapper/getNodes.md)
Returns the wrapper's underlying nodes.

#### [`.getDOMNode() => DOMComponent`](ReactWrapper/getDOMNode.md)
Returns the outer most DOMComponent of the current wrapper.

Expand Down Expand Up @@ -174,8 +168,8 @@ Manually sets props of the root component.
#### [`.setContext(context) => ReactWrapper`](ReactWrapper/setContext.md)
Manually sets context of the root component.

#### [`.instance() => ReactComponent`](ReactWrapper/instance.md)
Returns the instance of the root component.
#### [`.instance() => ReactComponent|DOMComponent`](ReactWrapper/instance.md)
Returns the wrapper's underlying instance.

#### [`.unmount() => ReactWrapper`](ReactWrapper/unmount.md)
A method that un-mounts the component.
Expand Down
6 changes: 2 additions & 4 deletions packages/enzyme/src/ReactWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,17 +190,15 @@ class ReactWrapper {
}

/**
* Gets the instance of the component being rendered as the root node passed into `mount()`.
*
* NOTE: can only be called on a wrapper instance that is also the root instance.
* Returns the wrapper's underlying instance.
*
* Example:
* ```
* const wrapper = mount(<MyComponent />);
* const inst = wrapper.instance();
* expect(inst).to.be.instanceOf(MyComponent);
* ```
* @returns {ReactComponent}
* @returns {ReactComponent|DOMComponent}
*/
instance() {
if (this.length !== 1) {
Expand Down

0 comments on commit 6767ce5

Please sign in to comment.