Skip to content

Commit

Permalink
Add docs for getElement() and getElements()
Browse files Browse the repository at this point in the history
  • Loading branch information
artiebits committed Dec 9, 2017
1 parent d60360c commit 63fa113
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# `.getNode() => ReactElement`
# `.getElement() => ReactElement`

Returns the wrapper's underlying node.
Returns the wrapped ReactElement.

If the current wrapper is wrapping the root component, returns the root component's latest render output.


#### Returns

`ReactElement`: The retrieved node.
`ReactElement`: The retrieved ReactElement.



Expand All @@ -26,11 +26,11 @@ function MyComponent() {
}

const wrapper = shallow(<MyComponent />);
expect(wrapper.getNode()).to.equal(element);
expect(wrapper.getElement()).to.equal(element);
```



#### Related Methods

- [`.getNodes() => Array<ReactElement>`](getNodes.md)
- [`.getElements() => Array<ReactElement>`](getElements.md)
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# `.getNodes() => Array<ReactElement>`
# `.getElements() => Array<ReactElement>`

Returns the wrapper's underlying nodes.
Returns the wrapped ReactElements

If the current wrapper is wrapping the root component, returns the root component's latest render output wrapped in an array.


#### Returns

`Array<ReactElement>`: The retrieved nodes.
`Array<ReactElement>`: The retrieved ReactElements.



Expand All @@ -27,11 +27,11 @@ function Test() {
}

const wrapper = shallow(<Test />);
expect(wrapper.find('span').getNodes()).to.deep.equal([one, two]);
expect(wrapper.find('span').getElements()).to.deep.equal([one, two]);
```



#### Related Methods

- [`.getNode() => ReactElement`](getNode.md)
- [`.getElement() => ReactElement`](getElement.md)
8 changes: 4 additions & 4 deletions docs/api/shallow.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ Returns a static HTML rendering of the current node.
#### [`.get(index) => ReactElement`](ShallowWrapper/get.md)
Returns the node at the provided index of the current wrapper.

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

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

#### [`.at(index) => ShallowWrapper`](ShallowWrapper/at.md)
Returns a wrapper of the node at the provided index of the current wrapper.
Expand Down

0 comments on commit 63fa113

Please sign in to comment.