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