From 234f5319a6736f6ec33b631cbf477ce296fd66be Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Sat, 29 Feb 2020 17:57:55 +0100 Subject: [PATCH] test: test initial navigation to / --- __tests__/router.spec.ts | 7 +++++++ playground/App.vue | 2 +- playground/router.ts | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) 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 }, -- 2.39.5