1
1
import { h , ComponentOptions , defineComponent } from 'vue'
2
2
3
- import { config , mount } from '../../src'
3
+ import { config , mount , RouterLinkStub } from '../../src'
4
4
import Hello from '../components/Hello.vue'
5
5
import ComponentWithoutName from '../components/ComponentWithoutName.vue'
6
6
import ComponentWithSlots from '../components/ComponentWithSlots.vue'
@@ -40,12 +40,13 @@ describe('mounting options: stubs', () => {
40
40
// https://github.com/vuejs/vue-test-utils-next/issues/249
41
41
it ( 'applies stubs globally' , ( ) => {
42
42
const Comp = defineComponent ( {
43
- template : '<div><router-link /><router-view /></div>'
43
+ template : '<div><foo />< router-link to="/foo" /><router-view /></div>'
44
44
} )
45
45
const wrapper = mount ( Comp , {
46
46
global : {
47
47
stubs : {
48
- RouterLink : true ,
48
+ Foo : true ,
49
+ RouterLink : RouterLinkStub ,
49
50
RouterView : defineComponent ( {
50
51
render ( ) {
51
52
return h ( 'span' )
@@ -56,8 +57,9 @@ describe('mounting options: stubs', () => {
56
57
} )
57
58
58
59
expect ( wrapper . html ( ) ) . toBe (
59
- '<div><router-link- stub></router-link- stub><span></span></div>'
60
+ '<div><foo- stub></foo- stub><a></a ><span></span></div>'
60
61
)
62
+ expect ( wrapper . getComponent ( RouterLinkStub ) . vm . to ) . toBe ( '/foo' )
61
63
} )
62
64
63
65
it ( 'stubs a functional component by its variable declaration name' , ( ) => {
0 commit comments