@@ -4,6 +4,7 @@ import VueRouter from 'vue-router'
44import mount from '~src/mount'
55import Component from '~resources/components/component.vue'
66import ComponentWithVuex from '~resources/components/component-with-vuex.vue'
7+ import ComponentWithRouter from '~resources/components/component-with-router.vue'
78
89describe ( 'createLocalVue' , ( ) => {
910 it ( 'installs Vuex without polluting global Vue' , ( ) => {
@@ -63,17 +64,34 @@ describe('createLocalVue', () => {
6364 expect ( typeof freshWrapper . vm . $route ) . to . equal ( 'undefined' )
6465 } )
6566
66- it ( 'installs Router after a previous installed ' , ( ) => {
67+ it ( 'Router should work properly with local Vue ' , ( ) => {
6768 const localVue = createLocalVue ( )
6869 localVue . use ( VueRouter )
6970 const routes = [
70- { path : '/foo' , component : Component }
71+ {
72+ path : '/' ,
73+ component : {
74+ render : h => h ( 'div' , 'home' )
75+ }
76+ } ,
77+ {
78+ path : '/foo' ,
79+ component : {
80+ render : h => h ( 'div' , 'foo' )
81+ }
82+ }
7183 ]
7284 const router = new VueRouter ( {
7385 routes
7486 } )
75- const wrapper = mount ( Component , { localVue, router } )
87+ const wrapper = mount ( ComponentWithRouter , { localVue, router } )
7688 expect ( wrapper . vm . $route ) . to . be . an ( 'object' )
89+
90+ expect ( wrapper . text ( ) ) . to . contain ( 'home' )
91+
92+ wrapper . find ( 'a' ) . trigger ( 'click' )
93+ expect ( wrapper . text ( ) ) . to . contain ( 'foo' )
94+
7795 const freshWrapper = mount ( Component )
7896 expect ( typeof freshWrapper . vm . $route ) . to . equal ( 'undefined' )
7997 } )
0 commit comments