本文整理汇总了TypeScript中angular2/testing.ComponentFixture类的典型用法代码示例。如果您正苦于以下问题:TypeScript ComponentFixture类的具体用法?TypeScript ComponentFixture怎么用?TypeScript ComponentFixture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ComponentFixture类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
return tcb.createAsync(ngBsTablePaging).then((fixture:ComponentFixture,done)=>{
fixture.componentInstance.pageSize = 100;
fixture.componentInstance.totalRecords = 500;
fixture.componentInstance.currPage = 4;
fixture.detectChanges();
let pgBtnEle = fixture.nativeElement.querySelectorAll('.pagination li');
expect(pgBtnEle.length).toBe(7);
expect(pgBtnEle[4].className).toContain('active');
})
示例2:
return prep.then((fixture: ComponentFixture) => {
fixture.detectChanges();
let debug = fixture.debugElement.query(By.css('md-sidenav'));
return {
fixture: fixture,
component: debug.componentInstance,
debug: debug
};
}).catch(console.error.bind(console));
示例3: expect
return tcb.createAsync(UserListItemComponent).then((fixture: ComponentFixture) => {
fixture.componentInstance.id = '50';
fixture.componentInstance.username = 'barretodavid';
fixture.componentInstance.email = 'barretollano@gmail.com';
fixture.detectChanges();
let compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('span.username')).toHaveText('Username: barretodavid');
expect(compiled.querySelector('span.email')).toHaveText('Email: barretollano@gmail.com');
});
示例4: expect
.then((fixture: ComponentFixture) => {
let instance: TestCmp = fixture.componentInstance;
instance.config.itemsPerPage = 1;
instance.config.currentPage = 50;
fixture.detectChanges();
let expected = ['1', '...', '48', '49', '50', '51', '52', '...', '100'];
expect(getPageLinkItems(fixture)).toEqual(expected);
});
示例5: Promise
.then((_) => {
fixture.detectChanges();
return new Promise((resolve) => {
// setTimeout(() => {
expect(_kmq).toContain(['identify', 'testUser']);
resolve();
// });
});
});
示例6: Promise
.then((_) => {
fixture.detectChanges();
return new Promise((resolve) => {
setTimeout(() => {
expect(analytics.identify).toHaveBeenCalledWith('1', { userId: '1', firstName: 'John', lastName: 'Doe' });
resolve();
}, 100);
});
});
示例7: Promise
.then((_) => {
fixture.detectChanges();
return new Promise((resolve) => {
setTimeout(() => {
expect(EventSpy).toHaveBeenCalledWith({ action: 'InitiateSearch', properties: { category: 'Search', eventType: 'click' } });
resolve();
});
});
});