Skip to content

Commit f88823a

Browse files
committed
fix(navcontroller): lazy loading is queued
1 parent 5776f76 commit f88823a

File tree

17 files changed

+667
-589
lines changed

17 files changed

+667
-589
lines changed

scripts/gulp/tasks/test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ function karmaTest(watch: boolean, done: Function) {
8585

8686
let karmaConfig = {
8787
configFile: join(SCRIPTS_ROOT, 'karma/karma.conf.js'),
88+
singleRun: true,
8889
};
8990

9091
if (watch) {
@@ -96,6 +97,9 @@ function karmaTest(watch: boolean, done: Function) {
9697
args: ['--grep', argv.testGrep]
9798
};
9899
}
100+
if (typeof argv.debug !== 'undefined') {
101+
karmaConfig.singleRun = false;
102+
}
99103

100104
new karma.Server(karmaConfig, done).start();
101105
}

scripts/karma/system.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;
44

55
// disable console debugs/errors/warns from printing out
66
console.debug = () => {};
7-
console.error = () => {};
7+
// console.error = () => {};
88
console.warn = () => {};
99

1010
__karma__.loaded = function () {};

src/animations/animation.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,13 @@ export class Animation {
103103
return 0;
104104
}
105105

106+
/**
107+
* Returns if the animation is a root one.
108+
*/
109+
isRoot(): boolean {
110+
return !this.parent;
111+
}
112+
106113
/**
107114
* Set the duration for this animation.
108115
*/

src/components/app/test/app.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ describe('App', () => {
167167
expect(plt.exitApp).not.toHaveBeenCalled();
168168
done();
169169
}).catch((err: Error) => {
170+
fail(err);
170171
done(err);
171-
});
172+
});
172173
});
173174

174175
it('should pop the second view in the root nav', () => {

src/components/nav/test/basic/pages/first-page/first-page.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
</ion-item>
4343
<ion-item>
4444
<ion-label>Toggle Can Leave</ion-label>
45-
<ion-toggle (click)="canLeave = !canLeave"></ion-toggle>
45+
<ion-toggle [(ngModel)]="canLeave"></ion-toggle>
4646
</ion-item>
4747
<button ion-item (click)="viewDismiss()">View Dismiss</button>
4848
<button ion-item (click)="quickPush()">New push during transition</button>

src/components/nav/test/nav.spec.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ describe('Nav', () => {
3434
expect(nav.setPages).toHaveBeenCalledWith(knownViews, null, null);
3535
done();
3636
}).catch((err: Error) => {
37+
fail(err);
3738
done(err);
3839
});
3940
});
@@ -56,6 +57,7 @@ describe('Nav', () => {
5657
expect(nav.setPages).toHaveBeenCalledWith(knownViews, null, null);
5758
done();
5859
}).catch((err: Error) => {
60+
fail(err);
5961
done(err);
6062
});
6163
});
@@ -72,7 +74,8 @@ describe('Nav', () => {
7274
promise.then(() => {
7375
expect(nav.push).toHaveBeenCalled();
7476
done();
75-
}).catch((err: Error) => {
77+
}).catch((err: Error) => {
78+
fail(err);
7679
done(err);
7780
});
7881
});

src/components/tabs/tab.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ export class Tab extends NavControllerBase {
292292
/**
293293
* @hidden
294294
*/
295-
load(opts: NavOptions, done?: Function) {
295+
load(opts: NavOptions, done?: () => void) {
296296
if (!this._loaded && this.root) {
297297
this.setElementClass('show-tab', true);
298298
this.push(this.root, this.rootParams, opts, done);
@@ -305,7 +305,7 @@ export class Tab extends NavControllerBase {
305305
this._dom.read(() => {
306306
this.resize();
307307
});
308-
done(true);
308+
done();
309309
}
310310
}
311311

src/components/tabs/test/tabs.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ describe('Tabs', () => {
162162
it('should get the tab', () => {
163163
var tabs = mockTabs();
164164
var tab0 = mockTab(tabs);
165-
tab0.setRoot(<any>{});
166165
var tab1 = mockTab(tabs);
167166

168167
expect(tabs.getIndex(tab0)).toEqual(0);

0 commit comments

Comments
 (0)