fix(angular): nav controller can pop views after leaving tabs outlet (#25690)

Resolves #18593
This commit is contained in:
Sean Perkins
2022-09-08 12:52:17 -04:00
committed by GitHub
parent 2969169f50
commit 725b13fa60
11 changed files with 159 additions and 3 deletions

View File

@ -243,6 +243,74 @@ describe('Tabs', () => {
});
})
describe('entry url - /tabs/account', () => {
beforeEach(() => {
cy.visit('/tabs/account');
});
it('should pop to previous view when leaving tabs outlet', () => {
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 1');
cy.get('#goto-tab1-page2').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 2 (1)');
cy.get('#goto-global').click();
cy.get('ion-title').should('contain.text', 'Global Page');
cy.get('#goto-prev-pop').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 2 (1)');
cy.get('#goto-prev').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 1');
/**
* Verifies that when entering the tabs outlet directly,
* the navController.pop() method does not pop the previous view,
* when you are at the root of the tabs outlet.
*/
cy.get('#goto-previous-page').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 1');
});
});
describe('entry url - /', () => {
it('should pop to the root outlet from the tabs outlet', () => {
cy.visit('/');
cy.get('ion-title').should('contain.text', 'Test App');
cy.get('ion-item').contains('Tabs test').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 1');
cy.get('#goto-tab1-page2').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 2 (1)');
cy.get('#goto-global').click();
cy.get('ion-title').should('contain.text', 'Global Page');
cy.get('#goto-prev-pop').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 2 (1)');
cy.get('#goto-prev').click();
cy.get('ion-title').should('contain.text', 'Tab 1 - Page 1');
cy.get('#goto-previous-page').click();
cy.get('ion-title').should('contain.text', 'Test App');
});
});
describe('entry url - /tabs/account/nested/1', () => {
beforeEach(() => {
cy.visit('/tabs/account/nested/1');