@@ -209,11 +209,11 @@ describe('RouterView', () => {
209
209
210
210
async function factory (
211
211
initialRoute : RouteLocationNormalizedLoose ,
212
- propsData : any = { }
212
+ props : any = { }
213
213
) {
214
214
const route = createMockedRoute ( initialRoute )
215
215
const wrapper = mount ( RouterView as any , {
216
- propsData ,
216
+ props ,
217
217
global : {
218
218
provide : route . provides ,
219
219
components : { RouterView } ,
@@ -242,14 +242,12 @@ describe('RouterView', () => {
242
242
243
243
it ( 'displays nested views' , async ( ) => {
244
244
const { wrapper } = await factory ( routes . nested )
245
- expect ( wrapper . html ( ) ) . toBe ( `<div><h2>Nested</h2><div>Foo</div></div>` )
245
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
246
246
} )
247
247
248
248
it ( 'displays deeply nested views' , async ( ) => {
249
249
const { wrapper } = await factory ( routes . nestedNested )
250
- expect ( wrapper . html ( ) ) . toBe (
251
- `<div><h2>Nested</h2><div><h2>Nested</h2><div>Foo</div></div></div>`
252
- )
250
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
253
251
} )
254
252
255
253
it ( 'renders when the location changes' , async ( ) => {
@@ -315,21 +313,17 @@ describe('RouterView', () => {
315
313
const route = createMockedRoute ( routes . root )
316
314
const wrapper = mount (
317
315
{
318
- template : `
319
- <div>
320
- <router-view/>
321
- </div>
322
- ` ,
316
+ template : `<div><router-view/></div>` ,
323
317
} ,
324
318
{
325
- propsData : { } ,
319
+ props : { } ,
326
320
global : {
327
321
provide : route . provides ,
328
322
components : { RouterView } ,
329
323
} ,
330
324
}
331
325
)
332
- expect ( wrapper . html ( ) ) . toBe ( `<div><div>Home</div></div>` )
326
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
333
327
expect ( 'can no longer be used directly inside' ) . not . toHaveBeenWarned ( )
334
328
} )
335
329
@@ -344,7 +338,7 @@ describe('RouterView', () => {
344
338
` ,
345
339
} ,
346
340
{
347
- propsData : { } ,
341
+ props : { } ,
348
342
global : {
349
343
provide : route . provides ,
350
344
components : { RouterView } ,
@@ -368,7 +362,7 @@ describe('RouterView', () => {
368
362
` ,
369
363
} ,
370
364
{
371
- propsData : { } ,
365
+ props : { } ,
372
366
global : {
373
367
stubs : {
374
368
transition : false ,
@@ -393,7 +387,7 @@ describe('RouterView', () => {
393
387
` ,
394
388
} ,
395
389
{
396
- propsData : { } ,
390
+ props : { } ,
397
391
global : {
398
392
stubs : {
399
393
transition : false ,
@@ -411,11 +405,11 @@ describe('RouterView', () => {
411
405
describe ( 'v-slot' , ( ) => {
412
406
async function factory (
413
407
initialRoute : RouteLocationNormalizedLoose ,
414
- propsData : any = { }
408
+ props : any = { }
415
409
) {
416
410
const route = createMockedRoute ( initialRoute )
417
411
const wrapper = await mount ( RouterView as any , {
418
- propsData ,
412
+ props ,
419
413
global : {
420
414
provide : route . provides ,
421
415
components : { RouterView } ,
@@ -425,27 +419,32 @@ describe('RouterView', () => {
425
419
<template #default="{ route, Component }">
426
420
<span>{{ route.name }}</span>
427
421
<component :is="Component"/>
428
- </template>` ,
422
+ </template>
423
+ ` ,
429
424
} ,
430
425
} )
431
426
427
+ // FIXME: the slot default is causing a warning with VTU
428
+ // https://github.com/vuejs/vue-test-utils-next/issues/549
429
+ expect ( '' ) . toHaveBeenWarned ( )
430
+
432
431
return { route, wrapper }
433
432
}
434
433
435
434
it ( 'passes a Component and route' , async ( ) => {
436
435
const { wrapper } = await factory ( routes . root )
437
- expect ( wrapper . html ( ) ) . toBe ( `<span>home</span><div>Home</div>` )
436
+ expect ( wrapper . html ( ) ) . toMatchSnapshot ( )
438
437
} )
439
438
} )
440
439
441
440
describe ( 'KeepAlive' , ( ) => {
442
441
async function factory (
443
442
initialRoute : RouteLocationNormalizedLoose ,
444
- propsData : any = { }
443
+ props : any = { }
445
444
) {
446
445
const route = createMockedRoute ( initialRoute )
447
446
const wrapper = await mount ( RouterView as any , {
448
- propsData ,
447
+ props ,
449
448
global : {
450
449
provide : route . provides ,
451
450
components : { RouterView } ,
@@ -460,6 +459,9 @@ describe('RouterView', () => {
460
459
} ,
461
460
} )
462
461
462
+ // FIXME: check comment above
463
+ expect ( '' ) . toHaveBeenWarned ( )
464
+
463
465
return { route, wrapper }
464
466
}
465
467
@@ -474,11 +476,11 @@ describe('RouterView', () => {
474
476
describe ( 'Suspense' , ( ) => {
475
477
async function factory (
476
478
initialRoute : RouteLocationNormalizedLoose ,
477
- propsData : any = { }
479
+ props : any = { }
478
480
) {
479
481
const route = createMockedRoute ( initialRoute )
480
482
const wrapper = await mount ( RouterView as any , {
481
- propsData ,
483
+ props ,
482
484
global : {
483
485
provide : route . provides ,
484
486
components : { RouterView } ,
@@ -493,6 +495,9 @@ describe('RouterView', () => {
493
495
} ,
494
496
} )
495
497
498
+ // FIXME: check comment above
499
+ expect ( '' ) . toHaveBeenWarned ( )
500
+
496
501
return { route, wrapper }
497
502
}
498
503
0 commit comments