當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript TestBed.compileComponents方法代碼示例

本文整理匯總了TypeScript中@angular/core/testing.TestBed.compileComponents方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript TestBed.compileComponents方法的具體用法?TypeScript TestBed.compileComponents怎麽用?TypeScript TestBed.compileComponents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/core/testing.TestBed的用法示例。


在下文中一共展示了TestBed.compileComponents方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     declarations: [
       MainComponent,
       MockTechsComponent,
       MockFooterComponent,
       MockHeaderComponent,
       MockTitleComponent
     ]
   });
   TestBed.compileComponents();
 }));
開發者ID:travist,項目名稱:presentations,代碼行數:12,代碼來源:main.spec.ts

示例2: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     imports: [MdSnackBarModule.forRoot(), SnackBarTestModule],
     providers: [
       {provide: OverlayContainer, useFactory: () => {
         overlayContainerElement = document.createElement('div');
         return {getContainerElement: () => overlayContainerElement};
       }}
     ],
   });
   TestBed.compileComponents();
 }));
開發者ID:RicardoVaranda,項目名稱:material2,代碼行數:12,代碼來源:snack-bar.spec.ts

示例3: beforeEach

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [OverlayModule, PortalModule, OverlayTestModule],
      providers: [
        {provide: ScrollDispatcher, useFactory: () => ({
          scrolled: () => scrolledSubject.asObservable()
        })}
      ]
    });

    TestBed.compileComponents();
  }));
開發者ID:GuzmanPI,項目名稱:material2,代碼行數:12,代碼來源:reposition-scroll-strategy.spec.ts

示例4: fakeAsync

       fakeAsync(() => {
         TestBed.configureTestingModule({declarations: [TestComponent]});
         TestBed.compileComponents();
         tick();

         const fixture = TestBed.createComponent(TestComponent);

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

         expect(fixture.debugElement.children[0].nativeElement).toHaveText('Hello');
       }));
開發者ID:AlmogShaul,項目名稱:angular,代碼行數:12,代碼來源:resource_loader_cache_spec.ts

示例5: beforeEach

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [StyleModule],
      declarations: [
        ButtonWithFocusClasses,
        ComplexComponentWithMonitorElementFocus,
        ComplexComponentWithMonitorSubtreeFocus,
      ],
    });

    TestBed.compileComponents();
  }));
開發者ID:attilacsanyi,項目名稱:material2,代碼行數:12,代碼來源:focus-origin-monitor.spec.ts

示例6: it

  it('should sent font-size to x-large', fakeAsync(() => {
    TestBed.compileComponents().then(() => {

      const fixture = TestBed.createComponent(TestComponent);
      fixture.detectChanges();
      tick();
      const element = fixture.debugElement.query(By.css('div'));

      expect(element.nativeElement.style.fontSize).toBe('x-large');

    });
  }));
開發者ID:apoterenko,項目名稱:angular2-dynamic-component,代碼行數:12,代碼來源:x-large.directive.spec.ts

示例7: it

    it('should have title Hello world', async(() => {
        TestBed.compileComponents().then(() => {
            let fixture: ComponentFixture<AppComponent>;
            fixture = TestBed.createComponent(AppComponent);
            fixture.detectChanges();

            let compiled = fixture.debugElement.nativeElement;
            expect(compiled).toBeDefined();
            // TODO: find a way to compile the routed component
            // expect(compiled.querySelector('div.title')).toMatch('Hello world');
        });
    }));
開發者ID:hloganathan,項目名稱:angular2-starter-1,代碼行數:12,代碼來源:app.component.spec.ts

示例8: beforeEach

  beforeEach(async(() => {
    // refine the test module by declaring the test component
    TestBed.configureTestingModule({
      declarations: [
        AppComponent,
      ],
      imports: [
        RouterTestingModule,
      ],
    });

    TestBed.compileComponents();
  }));
開發者ID:BrainCrumbz,項目名稱:AWATTS,代碼行數:13,代碼來源:app.component.spec.ts

示例9: it

    it('should properly initialize properties', async(() => {
        TestBed.compileComponents().then(() => {
            let fixture = TestBed.createComponent(NavbarIntializeTestComponent);
            fixture.detectChanges();

            expect(fixture.componentInstance.navbar.title).toBeUndefined();
            expect(fixture.componentInstance.navbar.isActionButtonVisible).toBeFalsy();
            expect(fixture.componentInstance.navbar.actionButtonIcon).toBeUndefined();
        }).catch(reason => {
            console.log(reason);
            return Promise.reject(reason);
        });
    }));
開發者ID:petko5kov,項目名稱:zero-blocks,代碼行數:13,代碼來源:navbar.component.spec.ts

示例10: beforeEach

 beforeEach(async(() => {
   TestBed.configureTestingModule({
     imports: [
       Angulartics2Module.forRoot([Angulartics2GoogleAnalytics]),
       RouterTestingModule,
       TranslateModule.forRoot(),
       CoreModule
     ],
     declarations: [AppComponent],
     providers: []
   });
   TestBed.compileComponents();
 }));
開發者ID:softsky,項目名稱:softsky.github.io,代碼行數:13,代碼來源:app.component.spec.ts


注:本文中的@angular/core/testing.TestBed.compileComponents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。