mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
chore(nav): make transition/stage private
This commit is contained in:
@@ -193,9 +193,7 @@ export class NavController extends Ion {
|
||||
}
|
||||
|
||||
// start the transition
|
||||
this.transition(enteringView, leavingView, opts, () => {
|
||||
resolve();
|
||||
});
|
||||
this._transition(enteringView, leavingView, opts, resolve);
|
||||
|
||||
return promise;
|
||||
}
|
||||
@@ -236,7 +234,7 @@ export class NavController extends Ion {
|
||||
}
|
||||
|
||||
// start the transition
|
||||
this.transition(enteringView, leavingView, opts, resolve);
|
||||
this._transition(enteringView, leavingView, opts, resolve);
|
||||
|
||||
} else {
|
||||
this._transComplete();
|
||||
@@ -285,7 +283,7 @@ export class NavController extends Ion {
|
||||
this.router.stateChange('pop', viewCtrl);
|
||||
}
|
||||
|
||||
this.transition(viewCtrl, leavingView, opts, resolve);
|
||||
this._transition(viewCtrl, leavingView, opts, resolve);
|
||||
|
||||
return promise;
|
||||
}
|
||||
@@ -432,7 +430,7 @@ export class NavController extends Ion {
|
||||
* @param {Function} done TODO
|
||||
* @returns {any} TODO
|
||||
*/
|
||||
transition(enteringView, leavingView, opts, done) {
|
||||
_transition(enteringView, leavingView, opts, done) {
|
||||
if (!enteringView || enteringView === leavingView) {
|
||||
return done();
|
||||
}
|
||||
@@ -445,7 +443,7 @@ export class NavController extends Ion {
|
||||
}
|
||||
|
||||
// wait for the new view to complete setup
|
||||
this.stage(enteringView, () => {
|
||||
this._stage(enteringView, () => {
|
||||
|
||||
if (enteringView.shouldDestroy) {
|
||||
// already marked as a view that will be destroyed, don't continue
|
||||
@@ -511,7 +509,7 @@ export class NavController extends Ion {
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
stage(viewCtrl, done) {
|
||||
_stage(viewCtrl, done) {
|
||||
if (viewCtrl.instance || viewCtrl.shouldDestroy) {
|
||||
// already compiled this view
|
||||
return done();
|
||||
@@ -627,7 +625,7 @@ export class NavController extends Ion {
|
||||
enteringView.willEnter();
|
||||
|
||||
// wait for the new view to complete setup
|
||||
enteringView.stage(() => {
|
||||
enteringView._stage(() => {
|
||||
|
||||
this._zone.runOutsideAngular(() => {
|
||||
// set that the new view pushed on the stack is staged to be entering/leaving
|
||||
|
||||
@@ -133,7 +133,7 @@ export function run() {
|
||||
|
||||
spyOn(nav, '_add').and.callThrough();
|
||||
|
||||
nav.transition = mockTransitionFn;
|
||||
nav._transition = mockTransitionFn;
|
||||
nav.push(FirstPage, {}, {}).then(() => {
|
||||
expect(nav._add).toHaveBeenCalled();
|
||||
expect(nav._views.length).toBe(1);
|
||||
@@ -163,7 +163,7 @@ export function run() {
|
||||
nav._views = [vc1, vc2, vc3];
|
||||
let arr = [FirstPage, SecondPage, ThirdPage];
|
||||
|
||||
nav.transition = mockTransitionFn;
|
||||
nav._transition = mockTransitionFn;
|
||||
nav.setViews(arr);
|
||||
|
||||
//_views[0] will be transitioned out of
|
||||
@@ -188,7 +188,7 @@ export function run() {
|
||||
nav.insert(FirstPage, 2);
|
||||
expect(nav.push).not.toHaveBeenCalled();
|
||||
|
||||
nav.transition = mockTransitionFn;
|
||||
nav._transition = mockTransitionFn;
|
||||
nav.insert(FirstPage, 4);
|
||||
expect(nav._views[4].componentType).toBe(FirstPage);
|
||||
expect(nav.push).toHaveBeenCalled();
|
||||
@@ -208,7 +208,7 @@ export function run() {
|
||||
nav._views = [vc1, vc2, vc3];
|
||||
expect(nav._views.length).toBe(3);
|
||||
|
||||
nav.transition = mockTransitionFn;
|
||||
nav._transition = mockTransitionFn;
|
||||
nav.setRoot(FirstPage);
|
||||
//_views[0] will be transitioned out of
|
||||
expect(nav._views.length).toBe(2);
|
||||
|
||||
Reference in New Issue
Block a user