Skip to content

Commit 1dec400

Browse files
Adam Golabljharb
authored andcommitted
Update ref docs to be consistent with version 3
1 parent baefd2c commit 1dec400

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

docs/api/ReactWrapper/ref.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# `.ref(refName) => ReactWrapper`
1+
# `.ref(refName) => ReactComponent`
22

3-
Returns a wrapper of the node that matches the provided reference name.
3+
Returns the node that matches the provided reference name.
44

55

66
NOTE: can only be called on a wrapper instance that is also the root instance.
@@ -12,7 +12,7 @@ NOTE: can only be called on a wrapper instance that is also the root instance.
1212

1313
#### Returns
1414

15-
`ReactWrapper`: A wrapper of the node that matches the provided reference name.
15+
`ReactComponent`: The node that matches the provided reference name.
1616

1717

1818

@@ -35,8 +35,7 @@ class Foo extends React.Component {
3535

3636
```jsx
3737
const wrapper = mount(<Foo />);
38-
expect(wrapper.ref('secondRef').prop('amount')).to.equal(4);
39-
expect(wrapper.ref('secondRef').text()).to.equal('Second');
38+
expect(wrapper.ref('secondRef').innerText).to.equal('Second');
4039
```
4140

4241

packages/enzyme/src/ReactWrapper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ class ReactWrapper {
187187

188188
/**
189189
* If the root component contained a ref, you can access it here
190-
* and get a wrapper around it.
190+
* and get an actual ref.
191191
*
192192
* NOTE: can only be called on a wrapper instance that is also the root instance.
193193
*
194194
* @param {String} refname
195-
* @returns {ReactWrapper}
195+
* @returns {ReactComponent}
196196
*/
197197
ref(refname) {
198198
if (this[ROOT] !== this) {

0 commit comments

Comments
 (0)