当前位置: 首页>>代码示例>>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;未经允许,请勿转载。