当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript testing.ComponentFixture类代码示例

本文整理汇总了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');
 })
开发者ID:jackeyli,项目名称:ng2-bootstrapTable,代码行数:9,代码来源:testbstablePaging.ts

示例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));
开发者ID:LiTiang,项目名称:ng2-material,代码行数:9,代码来源:sidenav_service_spec.ts

示例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');
 });
开发者ID:TNNSon,项目名称:angular2-unit-test-app,代码行数:9,代码来源:user-list-item.component.spec.ts

示例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);
                });
开发者ID:ppparihar,项目名称:ng2-pagination,代码行数:9,代码来源:pagination-controls-cmp.spec.ts

示例5: Promise

 .then((_) => {
   fixture.detectChanges();
   return new Promise((resolve) => {
     // setTimeout(() => {
       expect(_kmq).toContain(['identify', 'testUser']);
       resolve();
     // });
   });
 });
开发者ID:jamescarter-le,项目名称:angulartics2,代码行数:9,代码来源:angulartics2-kissmetrics.spec.ts

示例6: Promise

 .then((_) => {
   fixture.detectChanges();
   return new Promise((resolve) => {
     setTimeout(() => {
       expect(analytics.identify).toHaveBeenCalledWith('1', { userId: '1', firstName: 'John', lastName: 'Doe' });
       resolve();
     }, 100);
   });
 });
开发者ID:jamescarter-le,项目名称:angulartics2,代码行数:9,代码来源:angulartics2-segment.spec.ts

示例7: Promise

 .then((_) => {
   fixture.detectChanges();
   return new Promise((resolve) => {
     setTimeout(() => {
       expect(EventSpy).toHaveBeenCalledWith({ action: 'InitiateSearch', properties: { category: 'Search', eventType: 'click' } });
       resolve();
     });
   });
 });
开发者ID:JulioC,项目名称:angulartics2,代码行数:9,代码来源:angulartics2On.spec.ts


注:本文中的angular2/testing.ComponentFixture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。