From: Eduardo San Martin Morote Date: Fri, 24 Jul 2020 08:42:22 +0000 (+0200) Subject: test(router-view): test v-slot X-Git-Tag: v4.0.0-beta.4~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=667bc80af99870f1b1c71818990e0e9f8a86cee0;p=thirdparty%2Fvuejs%2Frouter.git test(router-view): test v-slot --- diff --git a/__tests__/RouterView.spec.ts b/__tests__/RouterView.spec.ts index 2f2ba4c3..812d5c24 100644 --- a/__tests__/RouterView.spec.ts +++ b/__tests__/RouterView.spec.ts @@ -29,7 +29,7 @@ const props = { default: false } const routes = createRoutes({ root: { fullPath: '/', - name: undefined, + name: 'home', path: '/', query: {}, params: {}, @@ -330,6 +330,7 @@ describe('RouterView', () => { expect(wrapper.html()).toBe(`
Home
`) expect('can no longer be used directly inside').not.toHaveBeenWarned() }) + it('warns if KeepAlive wraps a RouterView', async () => { const route = createMockedRoute(routes.root) const wrapper = await mount( @@ -393,6 +394,33 @@ describe('RouterView', () => { }) }) + describe('v-slot', () => { + async function factory( + initialRoute: RouteLocationNormalizedLoose, + propsData: any = {} + ) { + const route = createMockedRoute(initialRoute) + const wrapper = await mount(RouterView, { + propsData, + provide: route.provides, + components: { RouterView }, + slots: { + default: ` + {{ route.name }} + + `, + }, + }) + + return { route, wrapper } + } + + it('passes a Component and route', async () => { + const { wrapper } = await factory(routes.root) + expect(wrapper.html()).toBe(`home
Home
`) + }) + }) + describe('KeepAlive', () => { async function factory( initialRoute: RouteLocationNormalizedLoose,