Skip to content

Commit 60fd02f

Browse files
committed
chore: up versions
1 parent 9bf45f6 commit 60fd02f

File tree

3 files changed

+111
-81
lines changed

3 files changed

+111
-81
lines changed

__tests__/RouterView.spec.ts

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -209,11 +209,11 @@ describe('RouterView', () => {
209209

210210
async function factory(
211211
initialRoute: RouteLocationNormalizedLoose,
212-
propsData: any = {}
212+
props: any = {}
213213
) {
214214
const route = createMockedRoute(initialRoute)
215215
const wrapper = mount(RouterView as any, {
216-
propsData,
216+
props,
217217
global: {
218218
provide: route.provides,
219219
components: { RouterView },
@@ -242,14 +242,12 @@ describe('RouterView', () => {
242242

243243
it('displays nested views', async () => {
244244
const { wrapper } = await factory(routes.nested)
245-
expect(wrapper.html()).toBe(`<div><h2>Nested</h2><div>Foo</div></div>`)
245+
expect(wrapper.html()).toMatchSnapshot()
246246
})
247247

248248
it('displays deeply nested views', async () => {
249249
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()
253251
})
254252

255253
it('renders when the location changes', async () => {
@@ -315,21 +313,17 @@ describe('RouterView', () => {
315313
const route = createMockedRoute(routes.root)
316314
const wrapper = mount(
317315
{
318-
template: `
319-
<div>
320-
<router-view/>
321-
</div>
322-
`,
316+
template: `<div><router-view/></div>`,
323317
},
324318
{
325-
propsData: {},
319+
props: {},
326320
global: {
327321
provide: route.provides,
328322
components: { RouterView },
329323
},
330324
}
331325
)
332-
expect(wrapper.html()).toBe(`<div><div>Home</div></div>`)
326+
expect(wrapper.html()).toMatchSnapshot()
333327
expect('can no longer be used directly inside').not.toHaveBeenWarned()
334328
})
335329

@@ -344,7 +338,7 @@ describe('RouterView', () => {
344338
`,
345339
},
346340
{
347-
propsData: {},
341+
props: {},
348342
global: {
349343
provide: route.provides,
350344
components: { RouterView },
@@ -368,7 +362,7 @@ describe('RouterView', () => {
368362
`,
369363
},
370364
{
371-
propsData: {},
365+
props: {},
372366
global: {
373367
stubs: {
374368
transition: false,
@@ -393,7 +387,7 @@ describe('RouterView', () => {
393387
`,
394388
},
395389
{
396-
propsData: {},
390+
props: {},
397391
global: {
398392
stubs: {
399393
transition: false,
@@ -411,11 +405,11 @@ describe('RouterView', () => {
411405
describe('v-slot', () => {
412406
async function factory(
413407
initialRoute: RouteLocationNormalizedLoose,
414-
propsData: any = {}
408+
props: any = {}
415409
) {
416410
const route = createMockedRoute(initialRoute)
417411
const wrapper = await mount(RouterView as any, {
418-
propsData,
412+
props,
419413
global: {
420414
provide: route.provides,
421415
components: { RouterView },
@@ -425,27 +419,32 @@ describe('RouterView', () => {
425419
<template #default="{ route, Component }">
426420
<span>{{ route.name }}</span>
427421
<component :is="Component"/>
428-
</template>`,
422+
</template>
423+
`,
429424
},
430425
})
431426

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+
432431
return { route, wrapper }
433432
}
434433

435434
it('passes a Component and route', async () => {
436435
const { wrapper } = await factory(routes.root)
437-
expect(wrapper.html()).toBe(`<span>home</span><div>Home</div>`)
436+
expect(wrapper.html()).toMatchSnapshot()
438437
})
439438
})
440439

441440
describe('KeepAlive', () => {
442441
async function factory(
443442
initialRoute: RouteLocationNormalizedLoose,
444-
propsData: any = {}
443+
props: any = {}
445444
) {
446445
const route = createMockedRoute(initialRoute)
447446
const wrapper = await mount(RouterView as any, {
448-
propsData,
447+
props,
449448
global: {
450449
provide: route.provides,
451450
components: { RouterView },
@@ -460,6 +459,9 @@ describe('RouterView', () => {
460459
},
461460
})
462461

462+
// FIXME: check comment above
463+
expect('').toHaveBeenWarned()
464+
463465
return { route, wrapper }
464466
}
465467

@@ -474,11 +476,11 @@ describe('RouterView', () => {
474476
describe('Suspense', () => {
475477
async function factory(
476478
initialRoute: RouteLocationNormalizedLoose,
477-
propsData: any = {}
479+
props: any = {}
478480
) {
479481
const route = createMockedRoute(initialRoute)
480482
const wrapper = await mount(RouterView as any, {
481-
propsData,
483+
props,
482484
global: {
483485
provide: route.provides,
484486
components: { RouterView },
@@ -493,6 +495,9 @@ describe('RouterView', () => {
493495
},
494496
})
495497

498+
// FIXME: check comment above
499+
expect('').toHaveBeenWarned()
500+
496501
return { route, wrapper }
497502
}
498503

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`RouterView displays deeply nested views 1`] = `
4+
"<div>
5+
<h2>Nested</h2>
6+
<div>
7+
<h2>Nested</h2>
8+
<div>Foo</div>
9+
</div>
10+
</div>"
11+
`;
12+
13+
exports[`RouterView displays nested views 1`] = `
14+
"<div>
15+
<h2>Nested</h2>
16+
<div>Foo</div>
17+
</div>"
18+
`;
19+
20+
exports[`RouterView v-slot passes a Component and route 1`] = `
21+
"<span>home</span>
22+
<div>Home</div>"
23+
`;
24+
25+
exports[`RouterView warnings does not warn RouterView is wrapped 1`] = `
26+
"<div>
27+
<div>Home</div>
28+
</div>"
29+
`;

0 commit comments

Comments
 (0)