From: Eduardo San Martin Morote Date: Mon, 1 Mar 2021 09:33:30 +0000 (+0100) Subject: test(view): unit test keep alive and suspense X-Git-Tag: v4.0.5~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aba2d943517cf94e9cc3c776ce3fecb93a583654;p=thirdparty%2Fvuejs%2Frouter.git test(view): unit test keep alive and suspense --- diff --git a/__tests__/RouterView.spec.ts b/__tests__/RouterView.spec.ts index f1ae2c98..bfb1eda4 100644 --- a/__tests__/RouterView.spec.ts +++ b/__tests__/RouterView.spec.ts @@ -463,8 +463,40 @@ describe('RouterView', () => { return { route, wrapper } } - // TODO: maybe migrating to VTU 2 to handle this properly - it.skip('works', async () => { + it('works', async () => { + const { route, wrapper } = await factory(routes.root) + expect(wrapper.html()).toMatchInlineSnapshot(`"
Home
"`) + await route.set(routes.foo) + expect(wrapper.html()).toMatchInlineSnapshot(`"
Foo
"`) + }) + }) + + describe('Suspense', () => { + async function factory( + initialRoute: RouteLocationNormalizedLoose, + propsData: any = {} + ) { + const route = createMockedRoute(initialRoute) + const wrapper = await mount(RouterView as any, { + propsData, + global: { + provide: route.provides, + components: { RouterView }, + }, + slots: { + default: ` + `, + }, + }) + + return { route, wrapper } + } + + it('works', async () => { const { route, wrapper } = await factory(routes.root) expect(wrapper.html()).toMatchInlineSnapshot(`"
Home
"`) await route.set(routes.foo)