Skip to content

Commit

Permalink
fix(navcontroller): lazy loading is queued
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Apr 18, 2017
1 parent 5776f76 commit f88823a
Show file tree
Hide file tree
Showing 17 changed files with 667 additions and 589 deletions.
4 changes: 4 additions & 0 deletions scripts/gulp/tasks/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ function karmaTest(watch: boolean, done: Function) {

let karmaConfig = {
configFile: join(SCRIPTS_ROOT, 'karma/karma.conf.js'),
singleRun: true,
};

if (watch) {
Expand All @@ -96,6 +97,9 @@ function karmaTest(watch: boolean, done: Function) {
args: ['--grep', argv.testGrep]
};
}
if (typeof argv.debug !== 'undefined') {
karmaConfig.singleRun = false;
}

new karma.Server(karmaConfig, done).start();
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/karma/system.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000;

// disable console debugs/errors/warns from printing out
console.debug = () => {};
console.error = () => {};
// console.error = () => {};
console.warn = () => {};

__karma__.loaded = function () {};
Expand Down
7 changes: 7 additions & 0 deletions src/animations/animation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ export class Animation {
return 0;
}

/**
* Returns if the animation is a root one.
*/
isRoot(): boolean {
return !this.parent;
}

/**
* Set the duration for this animation.
*/
Expand Down
3 changes: 2 additions & 1 deletion src/components/app/test/app.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ describe('App', () => {
expect(plt.exitApp).not.toHaveBeenCalled();
done();
}).catch((err: Error) => {
fail(err);
done(err);
});
});
});

it('should pop the second view in the root nav', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</ion-item>
<ion-item>
<ion-label>Toggle Can Leave</ion-label>
<ion-toggle (click)="canLeave = !canLeave"></ion-toggle>
<ion-toggle [(ngModel)]="canLeave"></ion-toggle>
</ion-item>
<button ion-item (click)="viewDismiss()">View Dismiss</button>
<button ion-item (click)="quickPush()">New push during transition</button>
Expand Down
5 changes: 4 additions & 1 deletion src/components/nav/test/nav.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('Nav', () => {
expect(nav.setPages).toHaveBeenCalledWith(knownViews, null, null);
done();
}).catch((err: Error) => {
fail(err);
done(err);
});
});
Expand All @@ -56,6 +57,7 @@ describe('Nav', () => {
expect(nav.setPages).toHaveBeenCalledWith(knownViews, null, null);
done();
}).catch((err: Error) => {
fail(err);
done(err);
});
});
Expand All @@ -72,7 +74,8 @@ describe('Nav', () => {
promise.then(() => {
expect(nav.push).toHaveBeenCalled();
done();
}).catch((err: Error) => {
}).catch((err: Error) => {
fail(err);
done(err);
});
});
Expand Down
4 changes: 2 additions & 2 deletions src/components/tabs/tab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export class Tab extends NavControllerBase {
/**
* @hidden
*/
load(opts: NavOptions, done?: Function) {
load(opts: NavOptions, done?: () => void) {
if (!this._loaded && this.root) {
this.setElementClass('show-tab', true);
this.push(this.root, this.rootParams, opts, done);
Expand All @@ -305,7 +305,7 @@ export class Tab extends NavControllerBase {
this._dom.read(() => {
this.resize();
});
done(true);
done();
}
}

Expand Down
1 change: 0 additions & 1 deletion src/components/tabs/test/tabs.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ describe('Tabs', () => {
it('should get the tab', () => {
var tabs = mockTabs();
var tab0 = mockTab(tabs);
tab0.setRoot(<any>{});
var tab1 = mockTab(tabs);

expect(tabs.getIndex(tab0)).toEqual(0);
Expand Down
Loading

0 comments on commit f88823a

Please sign in to comment.