mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-12 03:52:25 +03:00
fix: call afterNavigation after nextTick (#478)
* fix: afterNavigation * style: use arrow function
This commit is contained in:
committed by
Pim
parent
c6b20eb1c0
commit
fa12530b3e
@@ -19,10 +19,12 @@ export function addNavGuards (rootVm) {
|
||||
})
|
||||
|
||||
router.afterEach(() => {
|
||||
const { metaInfo } = resume(rootVm)
|
||||
rootVm.$nextTick(() => {
|
||||
const { metaInfo } = resume(rootVm)
|
||||
|
||||
if (metaInfo && isFunction(metaInfo.afterNavigation)) {
|
||||
metaInfo.afterNavigation(metaInfo)
|
||||
}
|
||||
if (metaInfo && isFunction(metaInfo.afterNavigation)) {
|
||||
metaInfo.afterNavigation(metaInfo)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
@@ -271,6 +271,8 @@ describe('components', () => {
|
||||
expect(wrapper.vm.$root._vueMeta.pausing).toBe(true)
|
||||
|
||||
guards.after()
|
||||
expect(afterNavigation).not.toHaveBeenCalled()
|
||||
await vmTick(wrapper.vm)
|
||||
expect(afterNavigation).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
@@ -306,6 +308,8 @@ describe('components', () => {
|
||||
expect(wrapper.vm.$root._vueMeta.pausing).toBe(true)
|
||||
|
||||
guards.after()
|
||||
expect(afterNavigation).not.toHaveBeenCalled()
|
||||
await vmTick(wrapper.vm)
|
||||
expect(afterNavigation).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user