11/* eslint-disable no-console */
22import { createLocalVue , mount , RouterLinkStub } from '@vue/test-utils'
33import VueRouter from 'vue-router'
4- import { VueLink , VueLinkAddSlash , VueLinkStripSlash , ForNuxt } from '../lib'
4+ import { ForNuxt , VueLink , VueLinkAddSlash , VueLinkStripSlash } from '../lib'
55
66const localVue = createLocalVue ( )
77localVue . use ( VueRouter )
88
9- const hiComponent = {
10- name : 'hi-component' ,
11- template : '<div>Hi</div>'
12- }
9+ const hiComponent = '<div>Hi</div>'
1310
1411describe ( 'VueLink' , ( ) => {
1512 describe ( 'router-link' , ( ) => {
@@ -61,7 +58,7 @@ describe('VueLink', () => {
6158 const link = wrapper . find ( RouterLinkStub )
6259
6360 expect ( link . vm . $props . to ) . toBe ( '/test' )
64- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
61+ expect ( wrapper ) . toMatchSnapshot ( )
6562 } )
6663 } )
6764 describe ( 'external' , ( ) => {
@@ -85,7 +82,7 @@ describe('VueLink', () => {
8582 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
8683 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
8784
88- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
85+ expect ( wrapper ) . toMatchSnapshot ( )
8986 } )
9087 it ( 'does trigger external on https link' , ( ) => {
9188 const wrapper = mount ( VueLink , {
@@ -107,7 +104,7 @@ describe('VueLink', () => {
107104 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
108105 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
109106
110- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
107+ expect ( wrapper ) . toMatchSnapshot ( )
111108 } )
112109 it ( 'does trigger external on // link' , ( ) => {
113110 const wrapper = mount ( VueLink , {
@@ -129,7 +126,7 @@ describe('VueLink', () => {
129126 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
130127 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
131128
132- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
129+ expect ( wrapper ) . toMatchSnapshot ( )
133130 } )
134131 it ( 'does trigger external on external prop set' , ( ) => {
135132 const wrapper = mount ( VueLink , {
@@ -152,7 +149,7 @@ describe('VueLink', () => {
152149 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
153150 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
154151
155- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
152+ expect ( wrapper ) . toMatchSnapshot ( )
156153 } )
157154 it ( 'does set rel correctly' , ( ) => {
158155 const wrapper = mount ( VueLink , {
@@ -175,7 +172,7 @@ describe('VueLink', () => {
175172 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
176173 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
177174
178- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
175+ expect ( wrapper ) . toMatchSnapshot ( )
179176 } )
180177 it ( 'does set target on newTab correctly' , ( ) => {
181178 const wrapper = mount ( VueLink , {
@@ -198,7 +195,7 @@ describe('VueLink', () => {
198195 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
199196 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
200197
201- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
198+ expect ( wrapper ) . toMatchSnapshot ( )
202199 } )
203200 it ( 'does set target on prop correctly' , ( ) => {
204201 const wrapper = mount ( VueLink , {
@@ -221,7 +218,7 @@ describe('VueLink', () => {
221218 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
222219 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
223220
224- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
221+ expect ( wrapper ) . toMatchSnapshot ( )
225222 } )
226223 it ( 'does not bind href if unset' , ( ) => {
227224 const wrapper = mount ( VueLink , {
@@ -238,7 +235,7 @@ describe('VueLink', () => {
238235 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
239236 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
240237
241- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
238+ expect ( wrapper ) . toMatchSnapshot ( )
242239 } )
243240 it ( 'does bind custom prop' , ( ) => {
244241 const wrapper = mount ( VueLink , {
@@ -260,7 +257,7 @@ describe('VueLink', () => {
260257 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
261258 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
262259
263- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
260+ expect ( wrapper ) . toMatchSnapshot ( )
264261 } )
265262 it ( 'does bind classp' , ( ) => {
266263 const wrapper = mount ( VueLink , {
@@ -280,7 +277,7 @@ describe('VueLink', () => {
280277 expect ( wrapper . isVueInstance ( ) ) . toBe ( false )
281278 expect ( wrapper . contains ( RouterLinkStub ) ) . toBe ( false )
282279
283- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
280+ expect ( wrapper ) . toMatchSnapshot ( )
284281 } )
285282 } )
286283} )
@@ -335,7 +332,7 @@ describe('ForNuxt', () => {
335332 const link = wrapper . find ( RouterLinkStub )
336333
337334 expect ( link . vm . $props . to ) . toBe ( '/test' )
338- expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
335+ expect ( wrapper ) . toMatchSnapshot ( )
339336 } )
340337 } )
341338} )
0 commit comments