本文整理汇总了TypeScript中angular2/testing_internal.Log类的典型用法代码示例。如果您正苦于以下问题:TypeScript Log类的具体用法?TypeScript Log怎么用?TypeScript Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should process micro-tasks created in timers before next timers', fakeAsync(() => {
var log = new Log();
PromiseWrapper.resolve(null).then((_) => log.add('microtask'));
TimerWrapper.setTimeout(() => {
log.add('timer');
PromiseWrapper.resolve(null).then((_) => log.add('t microtask'));
}, 9);
var id = TimerWrapper.setInterval(() => {
log.add('periodic timer');
PromiseWrapper.resolve(null).then((_) => log.add('pt microtask'));
}, 10);
tick(10);
expect(log.result())
.toEqual('microtask; timer; t microtask; periodic timer; pt microtask');
tick(10);
expect(log.result())
.toEqual(
'microtask; timer; t microtask; periodic timer; pt microtask; periodic timer; pt microtask');
TimerWrapper.clearInterval(id);
}));
示例2: macroTask
macroTask(() => {
completerA = PromiseWrapper.completer();
completerB = PromiseWrapper.completer();
completerA.promise.then(_log.fn('a then'));
completerB.promise.then(_log.fn('b then'));
_log.add('run start');
});
示例3: scheduleMicroTask
ObservableWrapper.subscribe(_zone.onUnstable, (_) => {
_log.add('onUnstable(begin)');
if (!startPromiseRan) {
_log.add('onUnstable(schedulePromise)');
_zone.run(() => { scheduleMicroTask(_log.fn('onUnstable(executePromise)')); });
startPromiseRan = true;
}
_log.add('onUnstable(end)');
});