Skip to content

Ref selection doc updates #178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 16, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/en/api/selectors.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Selectors

A lot of methods take a selector as an argument. A selector can either be a CSS selector, or a Vue component.
A lot of methods take a selector as an argument. A selector can either be a CSS selector, a Vue component, or a find option object.

## CSS Selectors

Expand Down Expand Up @@ -41,3 +41,14 @@ import Foo from './Foo.vue'
const wrapper = shallow(Foo)
expect(wrapper.is(Foo)).toBe(true)
```

## Find Option Object

### Ref

Using a find option object, vue-test-utils allows for selecting elements by $ref on wrapper components.

```js
const buttonWrapper = wrapper.find({ ref: 'myButton' });
buttonWrapper.trigger('click');
```