本文整理匯總了TypeScript中angular2/core/testing.expect函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript expect函數的具體用法?TypeScript expect怎麽用?TypeScript expect使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了expect函數的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should truncate collection', () => {
let result = pipe.transform(collection, [{ itemsPerPage: 10, currentPage: 1 }]);
expect(result.length).toBe(10);
expect(result[0]).toBe('item 1');
expect(result[9]).toBe('item 10');
});
示例2: expect
.then((fixture: ComponentFixture<TestCmp>) => {
let instance: TestCmp = fixture.componentInstance;
instance.config.itemsPerPage = 100;
fixture.detectChanges();
expect(getPageLinkItems(fixture).length).toBe(0);
instance.autoHide = false;
fixture.detectChanges();
expect(getPageLinkItems(fixture).length).toBe(1);
});
示例3: 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);
});