mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 21:48:42 +08:00
@ -689,7 +689,10 @@ export class NavControllerBase extends Ion implements NavController {
|
||||
view._setNav(this);
|
||||
|
||||
// give this inserted view an ID
|
||||
view.id = this.id + '-' + (++this._ids);
|
||||
this._ids++;
|
||||
if (!view.id) {
|
||||
view.id = `${this.id}-${this._ids}`;
|
||||
}
|
||||
|
||||
// insert the entering view into the correct index in the stack
|
||||
this._views.splice(index, 0, view);
|
||||
|
@ -165,6 +165,15 @@ describe('NavController', () => {
|
||||
|
||||
describe('insert', () => {
|
||||
|
||||
it('should not modify the view id', () => {
|
||||
let view = mockView(MockView4);
|
||||
view.id = 'custom_id';
|
||||
nav.insert(0, view);
|
||||
|
||||
expect(view.id).toEqual('custom_id');
|
||||
});
|
||||
|
||||
|
||||
it('should insert at the begining with no async transition', () => {
|
||||
let view4 = mockView(MockView4);
|
||||
let instance4 = spyOnLifecycles(view4);
|
||||
|
Reference in New Issue
Block a user