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


TypeScript TestComponentBuilder.overrideProviders方法代码示例

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


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

示例1: injectAsync

 injectAsync([ TestComponentBuilder ], (tcb: TestComponentBuilder) => {
   return tcb.overrideProviders(AppComponent, ROUTER_PROVIDERS)
       .createAsync(AppComponent)
       .then(fixture => {
         expect(fixture.nativeElement.textContent).toBe('Hello!');
       });
 }));
开发者ID:jeffbcross,项目名称:issue-zero,代码行数:7,代码来源:app.spec.ts

示例2: beforeEach

 beforeEach(injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
   return tcb.overrideProviders(AppComponent, [
     Angular2Bridge,
     EntityManagerService,
     provide(MetadataStoreService, {useClass: TestMetadataStoreService})
   ])
   .createAsync(AppComponent).then(fix => {
     fixture = fix;
     comp = fixture.componentInstance;
   });
 }));
开发者ID:wardbell,项目名称:a2-bz-example,代码行数:11,代码来源:app.component.spec.ts

示例3: createComponent

 function createComponent(tcb: TestComponentBuilder): Promise<ComponentFixture> { 
   return tcb
     .overrideProviders(CreateUserComponent, [provide(UserService, {useClass: MockUserService})])
     .createAsync(CreateUserComponent)
     .then((fixture: ComponentFixture) => {
       element = fixture.debugElement.nativeElement;
       form = fixture.debugElement.query(By.css('form')).nativeElement;
       usernameInput = fixture.debugElement.query(By.css('#username')).nativeElement;
       emailInput = fixture.debugElement.query(By.css('#email')).nativeElement;
       fixture.detectChanges();
       return fixture;
     });
 }
开发者ID:aneagoie,项目名称:angular2-unit-test-app,代码行数:13,代码来源:create-user.component.spec.ts

示例4: it

      it('should do the right stuff', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
        return tcb.overrideProviders(TodoCmp, [provide(TodoService, {useClass: MockTodoService})]).createAsync(TodoCmp).then((fixture) => {
          fixture.detectChanges();

          let instance = fixture.debugElement.componentInstance;

          expect(instance.todoList.length).toBe(0);

          instance.add(1);

          expect(instance.todoList.length).toBe(1);
        });
      }));
开发者ID:Pishtiko,项目名称:angular2-typescript-todo,代码行数:13,代码来源:todo_cmp_test.ts


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