mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
This commit is contained in:
@@ -241,6 +241,25 @@ describe('Navigation Tests', () => {
|
||||
cy.ionPageVisible('settings-page')
|
||||
})
|
||||
|
||||
it('/routing/ > Details 1 > Details 2 > Details 3 > Back > Settings Tab > Home Tab > Should be at details 2 page', () => {
|
||||
// fixes an issue where route history was being lost after starting to go back, switching tabs
|
||||
// and switching back to the same tab again
|
||||
// for bug https://github.com/ionic-team/ionic-framework/issues/21834
|
||||
cy.visit(`http://localhost:${port}/routing`)
|
||||
cy.ionPageVisible('home-page')
|
||||
cy.ionNav('ion-item', 'Details 1')
|
||||
cy.ionPageVisible('home-details-page-1')
|
||||
cy.ionNav('ion-button', 'Go to Details 2')
|
||||
cy.ionPageVisible('home-details-page-2')
|
||||
cy.ionNav('ion-button', 'Go to Details 3')
|
||||
cy.ionPageVisible('home-details-page-3')
|
||||
cy.ionBackClick('home-details-page-3')
|
||||
cy.ionPageVisible('home-details-page-2')
|
||||
cy.ionTabClick('Settings')
|
||||
cy.ionPageVisible('settings-page')
|
||||
cy.ionTabClick('Home')
|
||||
cy.ionPageVisible('home-details-page-2')
|
||||
})
|
||||
/*
|
||||
Tests to add:
|
||||
Test that lifecycle events fire
|
||||
|
||||
@@ -110,6 +110,7 @@ class IonTabBarUnwrapped extends React.PureComponent<InternalProps, IonTabBarSta
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
const { activeTab: prevActiveTab } = state;
|
||||
if (activeTab && prevActiveTab) {
|
||||
const prevHref = state.tabs[prevActiveTab].currentHref;
|
||||
@@ -121,7 +122,7 @@ class IonTabBarUnwrapped extends React.PureComponent<InternalProps, IonTabBarSta
|
||||
originalRouteOptions: tabs[activeTab].originalRouteOptions,
|
||||
currentRouteOptions: props.routeInfo?.routeOptions
|
||||
};
|
||||
if (props.routeInfo.routeAction === 'pop') {
|
||||
if (props.routeInfo.routeAction === 'pop' && (activeTab !== prevActiveTab)) {
|
||||
// If navigating back and the tabs change, set the prev tab back to its original href
|
||||
tabs[prevActiveTab] = {
|
||||
originalHref: tabs[prevActiveTab].originalHref,
|
||||
|
||||
Reference in New Issue
Block a user