本文整理匯總了TypeScript中angular2/test_lib.tick函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript tick函數的具體用法?TypeScript tick怎麽用?TypeScript tick使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了tick函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: it
it("should not fire an event when explicitly specified", fakeAsync(() => {
ObservableWrapper.subscribe(c.valueChanges, (value) => { throw "Should not happen"; });
c.updateValue("newValue", {emitEvent: false});
tick();
}));