mirror of
https://github.com/XiaoDaiGua-Ray/ray-template.git
synced 2026-11-24 13:04:29 +08:00
Share workspace packages between Ray Admin and the interactive docs. BREAKING CHANGE: v6 is a new major line. v5 stays on legacy/v5.
23 lines
823 B
TypeScript
23 lines
823 B
TypeScript
import { useVueRouter } from '../../apps/admin/src/hooks/web/useVueRouter'
|
|
import { router } from '../../apps/admin/src/router'
|
|
|
|
it('shares the live router outside setup and exposes the current route after navigation', async () => {
|
|
const a = useVueRouter()
|
|
const b = useVueRouter()
|
|
const remove = router.addRoute({ path: '/router-hook-test', component: {} })
|
|
|
|
try {
|
|
expect(a.router).toBe(router)
|
|
expect(b.router.currentRoute).toBe(a.router.currentRoute)
|
|
await a.router.push('/router-hook-test?source=spec')
|
|
expect(b.router.currentRoute.value).toMatchObject({
|
|
path: '/router-hook-test',
|
|
query: { source: 'spec' },
|
|
})
|
|
await b.router.replace('/router-hook-test?source=replace')
|
|
expect(a.router.currentRoute.value.query.source).toBe('replace')
|
|
} finally {
|
|
remove()
|
|
}
|
|
})
|