本文整理汇总了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();
}));
示例2: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [MdSnackBarModule.forRoot(), SnackBarTestModule],
providers: [
{provide: OverlayContainer, useFactory: () => {
overlayContainerElement = document.createElement('div');
return {getContainerElement: () => overlayContainerElement};
}}
],
});
TestBed.compileComponents();
}));
示例3: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [OverlayModule, PortalModule, OverlayTestModule],
providers: [
{provide: ScrollDispatcher, useFactory: () => ({
scrolled: () => scrolledSubject.asObservable()
})}
]
});
TestBed.compileComponents();
}));
示例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');
}));
示例5: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [StyleModule],
declarations: [
ButtonWithFocusClasses,
ComplexComponentWithMonitorElementFocus,
ComplexComponentWithMonitorSubtreeFocus,
],
});
TestBed.compileComponents();
}));
示例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');
});
}));
示例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');
});
}));
示例8: beforeEach
beforeEach(async(() => {
// refine the test module by declaring the test component
TestBed.configureTestingModule({
declarations: [
AppComponent,
],
imports: [
RouterTestingModule,
],
});
TestBed.compileComponents();
}));
示例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);
});
}));
示例10: beforeEach
beforeEach(async(() => {
TestBed.configureTestingModule({
imports: [
Angulartics2Module.forRoot([Angulartics2GoogleAnalytics]),
RouterTestingModule,
TranslateModule.forRoot(),
CoreModule
],
declarations: [AppComponent],
providers: []
});
TestBed.compileComponents();
}));