diff --git a/core/src/components/router/test/guards/index.html b/core/src/components/router/test/guards/index.html index 05add1fa9b..f6775a08ac 100644 --- a/core/src/components/router/test/guards/index.html +++ b/core/src/components/router/test/guards/index.html @@ -33,17 +33,17 @@ router.push
- + ion-router-link
- href + href
`; const childButton = this.querySelector('#router-push'); childButton.addEventListener('click', () => { const r = document.querySelector('ion-router'); - r.push('/child'); + r.push('/child/1'); }); } } @@ -145,7 +145,7 @@ - + diff --git a/core/src/components/router/test/guards/router-link.e2e.ts b/core/src/components/router/test/guards/router-link.e2e.ts index fbb022e9ef..c42ee0aab5 100644 --- a/core/src/components/router/test/guards/router-link.e2e.ts +++ b/core/src/components/router/test/guards/router-link.e2e.ts @@ -13,7 +13,7 @@ test('router: guards - router-link - allow/allow', async () => { await page.waitForChanges(); - await checkUrl(page, '#/child'); + await checkUrl(page, '#/child/1'); const backButton = await page.$('ion-back-button'); await backButton.click(); @@ -78,14 +78,14 @@ test('router: guards - router-link - allow/block', async () => { await page.waitForChanges(); - await checkUrl(page, '#/child'); + await checkUrl(page, '#/child/1'); const backButton = await page.$('ion-back-button'); await backButton.click(); await page.waitForChanges(); - await checkUrl(page, '#/child'); + await checkUrl(page, '#/child/1'); }); // TODO this is an actual bug in the code. @@ -102,7 +102,7 @@ test('router: guards - router-link - allow/redirect', async () => { await page.waitForChanges(); - await checkUrl(page, '#/child'); + await checkUrl(page, '#/child/1'); const backButton = await page.$('ion-back-button'); await backButton.click(); diff --git a/core/src/components/router/utils/matching.ts b/core/src/components/router/utils/matching.ts index 69c4d3c9ad..90f1e99877 100644 --- a/core/src/components/router/utils/matching.ts +++ b/core/src/components/router/utils/matching.ts @@ -74,7 +74,9 @@ export const matchesPath = (inputPath: string[], chain: RouteChain): RouteChain return chain.map((route, i) => ({ id: route.id, path: route.path, - params: mergeParams(route.params, allparams![i]) + params: mergeParams(route.params, allparams![i]), + beforeEnter: route.beforeEnter, + beforeLeave: route.beforeLeave })); } return chain;