diff --git a/docs/api/selectors.md b/docs/api/selectors.md index 3c2428277..eb9ac4122 100644 --- a/docs/api/selectors.md +++ b/docs/api/selectors.md @@ -41,6 +41,35 @@ expect(wrapper.is(Foo)).toBe(true) ### Find Option Object +Suppose you have the following component +```js +// MyButtonComponent.vue + + + + +or + +const MyButtonComponent = { + template: '', + computed: { + myButtonRef() { + return 'dynamic-my-button-ref'; + } + } +}; +``` + #### Name Using a find option object, Vue Test Utils allows for selecting elements by a `name` of component on wrapper components. @@ -55,6 +84,6 @@ buttonWrapper.trigger('click') Using a find option object, Vue Test Utils allows for selecting elements by `$ref` on wrapper components. ```js -const buttonWrapper = wrapper.find({ ref: 'myButton' }) +const buttonWrapper = wrapper.find({ ref: 'dynamic-my-button-ref' }) buttonWrapper.trigger('click') ```