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


TypeScript TestComponentBuilder.overrideProviders方法代码示例

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


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

示例1: beforeEach

 beforeEach(inject(deps, fakeAsync((tcb: TestComponentBuilder) => {
     builder = tcb.overrideProviders(ProjectListComponent, [
         mdIconRegistryProvider,
         projectServiceProvider,
         routerProvider
     ]);
 })));
开发者ID:digitaldrummerj,项目名称:angular2-workshop,代码行数:7,代码来源:project-list.component.spec.ts

示例2: async

 async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
   tcb.overrideProviders(TestComponent, providerArr)
     .createAsync(TestComponent)
     .then((fixture) => {
       expect(fixture.nativeElement.innerText.indexOf('HOME')).toBeTruthy();
     });
 })));
开发者ID:dacho68,项目名称:angular2-seed,代码行数:7,代码来源:app.component.spec.ts

示例3: async

      async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
        tcb.overrideProviders(TestComponent, providerArr)
          .createAsync(TestComponent)
          .then((rootTC: any) => {
            let aboutDOMEl = rootTC.debugElement.children[0].nativeElement;

	    expect(getDOM().querySelectorAll(aboutDOMEl, 'h2')[0].textContent).toEqual('Features');
          });
        })));
开发者ID:dacho68,项目名称:angular2-seed,代码行数:9,代码来源:about.component.spec.ts

示例4: beforeEach

 beforeEach(inject(deps, fakeAsync((tcb: TestComponentBuilder) => {
   builder = tcb
     .overrideProviders(EmployeeNewComponent, [
       disableDeprecatedForms(),
       provideForms(),
       employeeServiceProvider,
       routerProvider
     ]);
 })));
开发者ID:digitaldrummerj,项目名称:angular2-workshop,代码行数:9,代码来源:employee-new.component.spec.ts

示例5: beforeEach

 beforeEach(inject(deps, fakeAsync((tcb: TestComponentBuilder) => {
   builder = tcb
     .overrideProviders(NavigationComponent, [
       provideRouter([], {enableTracing: true}),
       identityServiceProvider,
       localStorageProvider,
       routerProvider
     ]);
 })));
开发者ID:digitaldrummerj,项目名称:angular2-workshop,代码行数:9,代码来源:navigation.component.spec.ts

示例6: beforeEach

 beforeEach(async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
   return tcb.overrideProviders(AppComponent, [
     BreezeBridgeAngular2,
     EntityManagerService,
     provide(MetadataStoreService, {useClass: TestMetadataStoreService})
   ])
   .createAsync(AppComponent).then(fix => {
     fixture = fix;
     comp = fixture.componentInstance;
   });
 })));
开发者ID:Breeze,项目名称:breeze.js.samples,代码行数:11,代码来源:app.component.spec.ts

示例7: createComponent

  function createComponent(tcb: TestComponentBuilder): Promise<ComponentFixture<any>> {
    return tcb.overrideProviders(DemoFormWithCustomValidations, providerArr)
              .createAsync(DemoFormWithCustomValidations)
              .then((fixture) => {
      el = fixture.debugElement.nativeElement;
      input = fixture.debugElement.query(By.css("input")).nativeElement;
      form = fixture.debugElement.query(By.css("form")).nativeElement;
      fixture.detectChanges();

      return fixture;
    });
  }
开发者ID:yjw9012,项目名称:ng-book-2-forms,代码行数:12,代码来源:demo_form_with_custom_validations.spec.ts

示例8: it

      it('should do the right stuff', async(inject([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:alexpixel,项目名称:angular2-typescript-todo,代码行数:13,代码来源:todo_cmp_test.ts

示例9: async

      async(inject([TestComponentBuilder], (tcb: TestComponentBuilder) => {
        tcb.overrideProviders(TestComponent, providerArr)
          .createAsync(TestComponent)
          .then((rootTC: any) => {

            rootTC.detectChanges();

            let homeInstance = rootTC.debugElement.children[0].componentInstance;
            let homeDOMEl = rootTC.debugElement.children[0].nativeElement;

            expect(homeInstance.nameListService).toEqual(jasmine.any(NameListService));
            expect(getDOM().querySelectorAll(homeDOMEl, 'li').length).toEqual(0);

            homeInstance.newName = 'Minko';
            homeInstance.addName();

            rootTC.detectChanges();

            expect(getDOM().querySelectorAll(homeDOMEl, 'li').length).toEqual(1);
            expect(getDOM().querySelectorAll(homeDOMEl, 'li')[0].textContent).toEqual('Minko');
          });
      })));
开发者ID:dacho68,项目名称:angular2-seed,代码行数:22,代码来源:home.component.spec.ts


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