當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。