Skip to content

Commit e6dad3e

Browse files
committed
Do picture get() as a way to get stuff, not to check their existence
1 parent 4faf02d commit e6dad3e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/guide/conditional-rendering.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,19 @@ In the `<Nav>` component, a link to the user's profile is shown. In addition, if
3030

3131
## Using `get()`
3232

33-
`wrapper` has a `get()` method for asserting an element exists. It uses [`querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) syntax. We can assert the profile link is present using `get()`:
33+
`wrapper` has a `get()` method that searches for an existing element. It uses [`querySelector`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector) syntax.
34+
35+
We can assert the profile link content by using `get()`:
3436

3537
```js
3638
test('renders a profile link', () => {
3739
const wrapper = mount(Nav)
38-
wrapper.get('#profile')
40+
41+
// Here we are implicitly asserting that the
42+
// element #profile exists.
43+
const profileLink = wrapper.get('#profile')
44+
45+
expect(profileLink.text()).toEqual('My Profile')
3946
})
4047
```
4148

0 commit comments

Comments
 (0)