From: Eduardo San Martin Morote Date: Sat, 29 Feb 2020 16:57:55 +0000 (+0100) Subject: test: test initial navigation to / X-Git-Tag: v4.0.0-alpha.2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=234f5319a6736f6ec33b631cbf477ce296fd66be;p=thirdparty%2Fvuejs%2Frouter.git test: test initial navigation to / --- diff --git a/__tests__/router.spec.ts b/__tests__/router.spec.ts index 1f03a15a..d64dde5b 100644 --- a/__tests__/router.spec.ts +++ b/__tests__/router.spec.ts @@ -70,6 +70,13 @@ describe('Router', () => { ) }) + it('can do initial navigation to /', async () => { + const router = createRouter({ history: createMemoryHistory(), routes: [] }) + expect(router.currentRoute.value).toBe(START_LOCATION_NORMALIZED) + await router.push('/') + expect(router.currentRoute.value).not.toBe(START_LOCATION_NORMALIZED) + }) + it('calls history.replace with router.replace', async () => { const history = createMemoryHistory() const { router } = await newRouter({ history }) diff --git a/playground/App.vue b/playground/App.vue index fe0866d1..78823d42 100644 --- a/playground/App.vue +++ b/playground/App.vue @@ -47,7 +47,7 @@ >
  • - /currency=€uro&é=e (object)
  • diff --git a/playground/router.ts b/playground/router.ts index ee30c595..760a2cc7 100644 --- a/playground/router.ts +++ b/playground/router.ts @@ -18,7 +18,7 @@ export const routerHistory = createWebHistory() export const router = createRouter({ history: routerHistory, routes: [ - { path: '/', component: Home, name: 'home', alias: '/home' }, + { path: '/', component: Home }, { path: '/users/:id', name: 'user', component: User }, { path: '/documents/:id', name: 'docs', component: User }, { path: encodeURI('/n/€'), name: 'euro', component },