Skip to content

Commit 527911d

Browse files
committed
test(IonTabBar): test for onIonTabs[Did/Will]Change firing
1 parent 53b8177 commit 527911d

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • packages/react/test/base/tests/e2e/specs/tabs

packages/react/test/base/tests/e2e/specs/tabs/tabs.cy.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ describe('IonTabs', () => {
22
/**
33
* Verifies that tabs with similar route prefixes (e.g., /home, /home2, /home3)
44
* correctly select the matching tab instead of the first prefix match.
5-
*
5+
*
66
* @see https://github.com/ionic-team/ionic-framework/issues/30448
77
*/
88
describe('Similar Route Prefixes', () => {
@@ -58,7 +58,11 @@ describe('IonTabs', () => {
5858

5959
describe('Without IonRouterOutlet', () => {
6060
beforeEach(() => {
61-
cy.visit('/tabs-basic');
61+
cy.visit('/tabs-basic', {
62+
onBeforeLoad(win) {
63+
cy.spy(win.console, 'log').as('consoleLog');
64+
},
65+
});
6266
});
6367

6468
it.skip('should show correct tab when clicking the tab button', () => {
@@ -83,5 +87,12 @@ describe('IonTabs', () => {
8387

8488
cy.url().should('include', '/tabs-basic');
8589
});
90+
91+
it('should fire tab change events on tab click', () => {
92+
cy.get('ion-tab-button[tab="tab2"]').click();
93+
94+
cy.get('@consoleLog').should('be.calledWith', 'onIonTabsWillChange', 'tab2');
95+
cy.get('@consoleLog').should('be.calledWith', 'onIonTabsDidChange:', 'tab2');
96+
});
8697
});
8798
});

0 commit comments

Comments
 (0)