mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
fix(vue): tapping the active tab button now correctly resets the tab stack (#24935)
resolves #24934
This commit is contained in:
@ -47,7 +47,7 @@ export const IonTabButton = /*@__PURE__*/ defineComponent({
|
||||
*/
|
||||
if (prevActiveTab === tab) {
|
||||
if (originalHref !== currentHref) {
|
||||
ionRouter.resetTab(tab, originalHref);
|
||||
ionRouter.resetTab(tab);
|
||||
}
|
||||
} else {
|
||||
ionRouter.changeTab(tab, currentHref)
|
||||
|
@ -51,21 +51,68 @@ describe('Tabs', () => {
|
||||
cy.ionPageHidden('tab1');
|
||||
});
|
||||
|
||||
it('should return to tab root when clicking tab button', () => {
|
||||
it('should return to tab root when clicking tab button after going back', () => {
|
||||
cy.visit('http://localhost:8080/tabs')
|
||||
|
||||
cy.get('#child-one').click();
|
||||
cy.ionPageVisible('tab1childone');
|
||||
cy.ionPageHidden('tab1');
|
||||
|
||||
cy.get('#child-two').click();
|
||||
cy.ionPageHidden('tab1childone');
|
||||
cy.ionPageVisible('tab1childtwo');
|
||||
|
||||
cy.get('ion-tab-button#tab-button-tab1').click();
|
||||
|
||||
cy.ionPageVisible('tab1');
|
||||
|
||||
// TODO this page is not removed
|
||||
//cy.ionPageDoesNotExist('tab1childone');
|
||||
cy.ionPageDoesNotExist('tab1childone');
|
||||
cy.ionPageDoesNotExist('tab1childtwo');
|
||||
})
|
||||
|
||||
// Verifies fix for https://github.com/ionic-team/ionic-framework/issues/24934
|
||||
it('should return to tab root when clicking tab button', () => {
|
||||
cy.visit('http://localhost:8080/tabs')
|
||||
|
||||
cy.get('#child-one').click();
|
||||
cy.ionPageVisible('tab1childone');
|
||||
cy.ionPageHidden('tab1');
|
||||
|
||||
cy.get('#child-two').click();
|
||||
cy.ionPageHidden('tab1childone');
|
||||
cy.ionPageVisible('tab1childtwo');
|
||||
|
||||
cy.ionBackClick('tab1childtwo');
|
||||
cy.ionPageVisible('tab1childone');
|
||||
cy.ionPageDoesNotExist('tab1childtwo');
|
||||
|
||||
cy.get('ion-tab-button#tab-button-tab1').click();
|
||||
|
||||
cy.ionPageVisible('tab1');
|
||||
cy.ionPageDoesNotExist('tab1chilone');
|
||||
})
|
||||
|
||||
// Verifies fix for https://github.com/ionic-team/ionic-framework/issues/24934
|
||||
it('should return to tab root after replacing history', () => {
|
||||
cy.visit('http://localhost:8080/tabs')
|
||||
|
||||
cy.get('#child-one').click();
|
||||
cy.ionPageVisible('tab1childone');
|
||||
cy.ionPageHidden('tab1');
|
||||
|
||||
cy.get('ion-tab-button#tab-button-tab1').click();
|
||||
cy.ionPageVisible('tab1');
|
||||
cy.ionPageDoesNotExist('tab1chilone');
|
||||
|
||||
cy.get('#child-one').click();
|
||||
cy.ionPageVisible('tab1childone');
|
||||
cy.ionPageHidden('tab1');
|
||||
|
||||
cy.get('ion-tab-button#tab-button-tab1').click();
|
||||
cy.ionPageVisible('tab1');
|
||||
cy.ionPageDoesNotExist('tab1chilone');
|
||||
})
|
||||
|
||||
it('should be able to create and destroy tabs', () => {
|
||||
cy.visit('http://localhost:8080')
|
||||
|
||||
|
Reference in New Issue
Block a user