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


TypeScript TestComponentBuilder.createFakeAsync方法代码示例

本文整理汇总了TypeScript中@angular/compiler/testing.TestComponentBuilder.createFakeAsync方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestComponentBuilder.createFakeAsync方法的具体用法?TypeScript TestComponentBuilder.createFakeAsync怎么用?TypeScript TestComponentBuilder.createFakeAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在@angular/compiler/testing.TestComponentBuilder的用法示例。


在下文中一共展示了TestComponentBuilder.createFakeAsync方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: tick

    (router: Router, location: Location, tcb: TestComponentBuilder) => {
      tcb.createFakeAsync(AppComponent)
      router.navigate(['/'])
      tick()

      expect(location.path()).toBe('')
    }
开发者ID:aleksey-gonchar,项目名称:ng2-tour-of-heroes,代码行数:7,代码来源:app.spec.ts

示例2: fakeAsync

       fakeAsync(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
         let fixture = tcb.createFakeAsync(TestComponent);

         // This should initialize the fixture.
         tick();

         expect(fixture.debugElement.children[0].nativeElement).toHaveText('Hello');
       })));
开发者ID:jessepinho,项目名称:angular,代码行数:8,代码来源:xhr_cache_spec.ts

示例3: it

  it('should display the weather ', fakeAsync(() => {
    let fixture = testComponentBuilder.createFakeAsync(WeatherComponent);
    let element = fixture.nativeElement;
    let component = fixture.componentInstance;
    component.weather = {place: 'New York', humidity: 44, temperature: 57};

    fixture.detectChanges();

    expect(element.querySelector('h3').innerHTML).toBe('Current weather in New York:');
    expect(element.querySelector('li:nth-of-type(1)').innerHTML).toBe('Temperature: 57F');
    expect(element.querySelector('li:nth-of-type(2)').innerHTML).toBe('Humidity: 44%');
  }));
开发者ID:JoostVanAverbeke,项目名称:test_weather,代码行数:12,代码来源:weather.spec.ts

示例4: advance

		(tcb: TestComponentBuilder, location: Location, angulartics2: Angulartics2, angulartics2Piwik: Angulartics2Piwik) => {
		  fixture = tcb.createFakeAsync(RootCmp);
		  angulartics2.setUserProperties.next({ userId: '1', firstName: 'John', lastName: 'Doe' });
		  advance(fixture);
		  expect(_paq).toContain(['setCustomVariable', { userId: '1', firstName: 'John', lastName: 'Doe' }]);
		})));
开发者ID:IDEXXIHD,项目名称:angulartics2,代码行数:6,代码来源:angulartics2-piwik.spec.ts

示例5: tick

 (router: Router, location: Location, tcb: TestComponentBuilder) => {
   tcb.createFakeAsync(MyApp);
   router.navigateByUrl('/about');
   tick();
   expect(location.path()).toEqual('/about');
 })
开发者ID:AviFix,项目名称:angular2typescript,代码行数:6,代码来源:app.spec.ts


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