本文整理匯總了TypeScript中angular2/core/testing.tick函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript tick函數的具體用法?TypeScript tick怎麽用?TypeScript tick使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了tick函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: tick
.then((controlsInstance: PaginationControlsCmp) => {
testCmpInstance.config.currentPage = 1;
fixture.detectChanges();
tick();
expect(controlsInstance.isLastPage()).toBe(false);
testCmpInstance.config.currentPage = 10;
fixture.detectChanges();
tick();
expect(controlsInstance.isLastPage()).toBe(true);
});
示例2: spyOn
.then((controlsInstance: PaginationControlsCmp) => {
spyOn(testCmpInstance, 'pageChanged');
controlsInstance.next();
tick();
expect(testCmpInstance.pageChanged).toHaveBeenCalledWith(3);
});
示例3: expect
.then((fixture: ComponentFixture<TestCmp>) => {
let instance: TestCmp = fixture.componentInstance;
let expected = ['1', '2', '3', '4', '5', '6', '7', '...', '10'];
fixture.detectChanges();
expect(getPageLinkItems(fixture)).toEqual(expected);
instance.collection.push('item 101');
fixture.detectChanges();
tick();
fixture.detectChanges();
expected = ['1', '2', '3', '4', '5', '6', '7', '...', '11'];
expect(getPageLinkItems(fixture)).toEqual(expected);
});