Skip to content

Commit 51025ae

Browse files
committed
fix issue and add test
1 parent 8a86cfb commit 51025ae

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

packages/vue-router/src/locationHistory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ export const createLocationHistory = () => {
110110
if (existingRouteIndex === -1) return;
111111

112112
locationHistory[existingRouteIndex].pathname = routeInfo.pathname;
113+
locationHistory[existingRouteIndex].pushedByRoute = routeInfo.pushedByRoute;
113114
}
114115

115116
/**

packages/vue/test-app/tests/e2e/specs/routing.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,50 @@ describe('Routing', () => {
333333
cy.ionPageVisible('home');
334334
cy.ionPageDoesNotExist('routing');
335335
cy.ionPageDoesNotExist('routingparameter-abc');
336+
});
337+
338+
it.only('should choose correct view when navigating back', () => {
339+
cy.visit('http://localhost:8080');
340+
341+
cy.routerPush('/routing');
342+
cy.ionPageVisible('routing');
343+
cy.ionPageHidden('home');
344+
345+
cy.routerPush('/routing/123/view');
346+
cy.ionPageVisible('routingparameterview');
347+
cy.ionPageHidden('routing');
348+
349+
cy.routerPush('/routing/child');
350+
cy.ionPageVisible('routingchild');
351+
cy.ionPageHidden('routing');
352+
353+
cy.ionBackClick('routingchild');
354+
cy.ionPageVisible('routingparameterview');
355+
cy.ionPageDoesNotExist('routingchild');
356+
357+
cy.ionBackClick('routingparameterview');
358+
cy.ionPageVisible('routing');
359+
cy.ionPageDoesNotExist('routingparameterview');
360+
361+
cy.ionBackClick('routing');
362+
cy.ionPageVisible('home');
363+
cy.ionPageDoesNotExist('routing');
364+
365+
cy.routerPush('/routing');
366+
cy.ionPageVisible('routing');
367+
cy.ionPageHidden('home');
368+
369+
cy.routerPush('/routing/456/view');
370+
cy.ionPageVisible('routingparameterview');
371+
cy.ionPageHidden('routing');
372+
373+
cy.routerPush('/routing/child');
374+
cy.ionPageVisible('routingchild');
375+
cy.ionPageHidden('routing');
376+
377+
cy.ionBackClick('routingchild');
378+
cy.ionPageVisible('routingparameterview');
379+
cy.ionPageDoesNotExist('routingchild');
336380
})
337381
});
338382

0 commit comments

Comments
 (0)