Skip to content

Commit 80e051a

Browse files
G-Rathcexbrayat
authored andcommitted
docs: mention shallowMount stub name changes in migration guide
1 parent 9fc7cfd commit 80e051a

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/migration/index.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,38 @@ import { config } from '@vue/test-utils'
209209
config.global.renderStubDefaultSlot = true
210210
```
211211
212+
### `shallowMount` now always uses kebab-case for components stubs
213+
214+
**Before**:
215+
216+
```js
217+
import { shallowMount } from '@vue/test-utils'
218+
import App from '@/App.vue'
219+
220+
describe('App.vue', () => {
221+
it('finds the helloworld component', () => {
222+
const wrapper = shallowMount(App, {})
223+
const componentStub = wrapper.find('helloworld-stub');
224+
expect(componentStub.html()).toBeTruthy();
225+
})
226+
})
227+
```
228+
229+
**After**:
230+
231+
```js
232+
import { shallowMount } from '@vue/test-utils'
233+
import App from '@/App.vue'
234+
235+
describe('App.vue', () => {
236+
it('finds the helloworld component', () => {
237+
const wrapper = shallowMount(App, {})
238+
const componentStub = wrapper.find('hello-world-stub');
239+
expect(componentStub.html()).toBeTruthy();
240+
})
241+
})
242+
```
243+
212244
### `destroy` is now `unmount` to match Vue 3
213245
214246
Vue 3 renamed the `vm.$destroy` to `vm.$unmount`. Vue Test Utils has followed suit; `wrapper.destroy()` is now `wrapper.unmount()`.

0 commit comments

Comments
 (0)