From 1dec400dfcc2e98d09eeed5d95d1d093ec255e1c Mon Sep 17 00:00:00 2001 From: Adam Golab Date: Mon, 9 Oct 2017 09:18:50 +0200 Subject: [PATCH] Update ref docs to be consistent with version 3 --- docs/api/ReactWrapper/ref.md | 9 ++++----- packages/enzyme/src/ReactWrapper.js | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/api/ReactWrapper/ref.md b/docs/api/ReactWrapper/ref.md index fc581e97d..663aa69e2 100644 --- a/docs/api/ReactWrapper/ref.md +++ b/docs/api/ReactWrapper/ref.md @@ -1,6 +1,6 @@ -# `.ref(refName) => ReactWrapper` +# `.ref(refName) => ReactComponent` -Returns a wrapper of the node that matches the provided reference name. +Returns the node that matches the provided reference name. 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. #### Returns -`ReactWrapper`: A wrapper of the node that matches the provided reference name. +`ReactComponent`: The node that matches the provided reference name. @@ -35,8 +35,7 @@ class Foo extends React.Component { ```jsx const wrapper = mount(); -expect(wrapper.ref('secondRef').prop('amount')).to.equal(4); -expect(wrapper.ref('secondRef').text()).to.equal('Second'); +expect(wrapper.ref('secondRef').innerText).to.equal('Second'); ``` diff --git a/packages/enzyme/src/ReactWrapper.js b/packages/enzyme/src/ReactWrapper.js index 5b97a5a0a..4a2ae1cda 100644 --- a/packages/enzyme/src/ReactWrapper.js +++ b/packages/enzyme/src/ReactWrapper.js @@ -187,12 +187,12 @@ class ReactWrapper { /** * If the root component contained a ref, you can access it here - * and get a wrapper around it. + * and get an actual ref. * * NOTE: can only be called on a wrapper instance that is also the root instance. * * @param {String} refname - * @returns {ReactWrapper} + * @returns {ReactComponent} */ ref(refname) { if (this[ROOT] !== this) {