refactor(nav): create NavControllerBase and public abstract class

Use NavController as the public API, and NavControllerBase as the
internal API. Refactored all app/nav/tabs unit tests and created
centralized mocking functions.
This commit is contained in:
Adam Bradley
2016-07-15 15:54:56 -05:00
parent 5909fa4ba5
commit 0a7d865975
17 changed files with 3384 additions and 3307 deletions

View File

@ -5,7 +5,7 @@ import { Config } from '../../config/config';
import { Keyboard } from '../../util/keyboard';
import { GestureController } from '../../gestures/gesture-controller';
import { isTrueProperty } from '../../util/util';
import { NavController } from './nav-controller';
import { NavControllerBase } from './nav-controller-base';
import { ViewController } from './view-controller';
/**
@ -114,13 +114,13 @@ import { ViewController } from './view-controller';
`,
encapsulation: ViewEncapsulation.None,
})
export class Nav extends NavController implements AfterViewInit {
export class Nav extends NavControllerBase implements AfterViewInit {
private _root: any;
private _hasInit: boolean = false;
constructor(
@Optional() viewCtrl: ViewController,
@Optional() parent: NavController,
@Optional() parent: NavControllerBase,
app: App,
config: Config,
keyboard: Keyboard,
@ -164,9 +164,6 @@ export class Nav extends NavController implements AfterViewInit {
this._hasInit = true;
if (this._root) {
if (typeof this._root !== 'function') {
throw 'The [root] property in <ion-nav> must be given a reference to a component class from within the constructor.';
}
this.push(this._root);
}
}