fix(nav): view.id is not overridden

fixes #8794
This commit is contained in:
Manu Mtz.-Almeida
2016-10-20 22:06:43 +02:00
parent 780717e3d5
commit 8b65398044
2 changed files with 13 additions and 1 deletions

View File

@ -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);

View File

@ -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);