diff --git a/packages/react/src/components/navigation/IonTabBar.tsx b/packages/react/src/components/navigation/IonTabBar.tsx index 124b00f6990..ab1db62f197 100644 --- a/packages/react/src/components/navigation/IonTabBar.tsx +++ b/packages/react/src/components/navigation/IonTabBar.tsx @@ -224,12 +224,20 @@ class IonTabBarUnwrapped extends React.PureComponent { /** * Verifies that tabs with similar route prefixes (e.g., /home, /home2, /home3) * correctly select the matching tab instead of the first prefix match. - * + * * @see https://github.com/ionic-team/ionic-framework/issues/30448 */ describe('Similar Route Prefixes', () => { @@ -58,7 +58,11 @@ describe('IonTabs', () => { describe('Without IonRouterOutlet', () => { beforeEach(() => { - cy.visit('/tabs-basic'); + cy.visit('/tabs-basic', { + onBeforeLoad(win) { + cy.spy(win.console, 'log').as('consoleLog'); + }, + }); }); it.skip('should show correct tab when clicking the tab button', () => { @@ -83,5 +87,12 @@ describe('IonTabs', () => { cy.url().should('include', '/tabs-basic'); }); + + it('should fire tab change events on tab click', () => { + cy.get('ion-tab-button[tab="tab2"]').click(); + + cy.get('@consoleLog').should('be.calledWith', 'onIonTabsWillChange', 'tab2'); + cy.get('@consoleLog').should('be.calledWith', 'onIonTabsDidChange:', 'tab2'); + }); }); });