Skip to content

Commit aa31914

Browse files
authored
vue: Clarify what the return value of the callback param does in render (testing-library#719)
* Clarify how the callback param works in `render` I'm currently learning vue-testing-library and had some trouble trying to set up `vuex` instance with `simple-vuex`. I found out elsewhere that the best way to do this would be to use the callback parameter to return a store like ```tsx const store = createVuexStore(new RootStore()) render(MyComponent, {props: {happy: true}}, () => ({ store })) ``` I think I could have noticed this sooner if the documentation described this line in the code: https://github.com/testing-library/vue-testing-library/blob/2312e180b12df3c599e8aa8a0ee85dcff7b108e7/src/vue-testing-library.js#L52. This is what i have tried to do in my proposed change above. * Clarify that the return is merged with options, link to vue-i18n example
1 parent e3274e7 commit aa31914

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/vue-testing-library/api.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ Router.
8181
function callbackFunction(vueInstance, vuexStore, router) {}
8282
```
8383

84-
A callback function that receives the Vue instance as a parameter. This allows
85-
3rd party plugins to be installed prior to mount.
84+
A callback function that receives the Vue instance as a parameter. Its return value is merged with [options](#options), allowing
85+
3rd party plugins to be installed prior to mount. To see how this works, see the example using [`vue-i18n`](https://github.com/testing-library/vue-testing-library/blob/master/src/__tests__/vue-i18n.js).
8686

8787
The function will also receive the Store or the Router object if the associated
8888
option was passed in during render.

0 commit comments

Comments
 (0)