本文整理匯總了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();
}));