@@ -290,3 +290,43 @@ If you use snapshot testing and comment nodes are leaking into your snapshots, n
290
290
}
291
291
```
292
292
- Via `@vue/test-utils` [`mountingOptions.global.config`](https://test-utils.vuejs.org/api/#global) either globally or on per-test basis.
293
+
294
+ ## Comparison with v1
295
+
296
+ This is table for those coming from VTU 1, comparing the two APIs.
297
+
298
+ ### Mounting Options
299
+
300
+ | option | notes |
301
+ |------------------|-----------------------------------------------------------------------------------|
302
+ | mocks | nested in `global` |
303
+ | propsData | now called `props` |
304
+ | provide | nested in `global` |
305
+ | mixins | nested in `global` |
306
+ | plugins | nested in `global` |
307
+ | component | nested in `global` |
308
+ | directives | nested in `global` |
309
+ | attachToDocument | renamed `attachTo`. See [here](https://github.com/vuejs/vue-test-utils/pull/1492) |
310
+ | scopedSlots | removed. ScopedSlots are merged with `slots` in Vue 3 |
311
+ | context | removed. Different from Vue 2, does not make sense anymore. |
312
+ | localVue | removed. No longer required - in Vue 3 there is no global Vue instance to mutate. |
313
+ | listeners | removed. No longer exists in Vue 3 |
314
+ | parentComponent | removed |
315
+
316
+ ### Wrapper API (mount)
317
+
318
+ | method | notes |
319
+ |----------------|---------------------------------------------------------------------------------------------|
320
+ | find | only `querySelector` syntax is supported. Use `findComponent(Comp)` to find a Vue component |
321
+ | setValue | works for select, checkbox, radio button, input, textarea. Returns `nextTick`. |
322
+ | trigger | returns `nextTick`. You can do `await wrapper.find(' button' ).trigger(' click' )` |
323
+ | destroy | renamed to `unmount` to match Vue 3 lifecycle hook name. |
324
+ | contains | removed. Use `find` |
325
+ | emittedByOrder | removed. Use `emitted` |
326
+ | setSelected | removed. Now part of `setValue` |
327
+ | setChecked | removed. Now part of `setValue` |
328
+ | is | removed |
329
+ | isEmpty | removed. Use matchers such as [this](https://github.com/testing-library/jest-dom#tobeempty) |
330
+ | isVueInstance | removed |
331
+ | name | removed |
332
+ | setMethods | removed |
0 commit comments