Skip to content

Commit cff91c9

Browse files
authored
Merge pull request #1401 from wes-harper-ibotta/docs/vue-lifecycle-documentation/#1400
Update documentation to include information about lifecycle hooks
2 parents 9ac748b + 3652a53 commit cff91c9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

docs/guides/common-tips.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ const wrapper = shallowMount(Component)
2727
wrapper.vm // the mounted Vue instance
2828
```
2929

30+
### Lifecycle Hooks
31+
32+
When using either the `mount` or `shallowMount` methods, you can expect your component to respond to all lifecycle events. However, it is important to note that `beforeDestroy` and `destroyed` _will not be triggered_ unless the component is manually destroyed using `Wrapper.destroy()`.
33+
34+
Additionally, the component will not be automatically destroyed at the end of each spec, and it is up to the user to stub or manually clean up tasks that will continue to run (`setInterval` or `setTimeout`, for example) before the end of each spec.
35+
3036
### Writing asynchronous tests using `nextTick` (new)
3137

3238
By default, Vue batches updates to run asynchronously (on the next "tick"). This is to prevent unnecessary DOM re-renders, and watcher computations ([see the docs](https://vuejs.org/v2/guide/reactivity.html#Async-Update-Queue) for more details).

0 commit comments

Comments
 (0)