Deprecation Notes
Use TestBed.configureTestModule
/ TestBed.override...
/ TestBed.createComponent
instead.
Class Overview
class TestComponentBuilder {
constructor
(_injector: Injector)
overrideTemplate
(componentType: Type, template: string) : TestComponentBuilder
overrideView
(componentType: Type, view: ViewMetadata) : TestComponentBuilder
overrideDirective
(componentType: Type, from: Type, to: Type) : TestComponentBuilder
overrideProviders
(type: Type, providers: any[]) : TestComponentBuilder
overrideViewProviders
(type: Type, providers: any[]) : TestComponentBuilder
overrideAnimations
(componentType: Type, animations: AnimationEntryMetadata[]) : TestComponentBuilder
createFromFactory
(ngZone: NgZone, componentFactory: ComponentFactory<C>) : ComponentFixture<C>
createAsync
(rootComponentType: ConcreteType<T>) : Promise<ComponentFixture<T>>
createFakeAsync
(rootComponentType: ConcreteType<T>) : ComponentFixture<T>
createSync
(rootComponentType: ConcreteType<T>) : ComponentFixture<T>
}
Class Description
Builds a ComponentFixture for use in component level tests.
Class Export
export class TestComponentBuilder
Annotations
@Injectable()
Class Details
overrideTemplate(componentType: Type, template: string) : TestComponentBuilder
Overrides only the html of a ComponentMetadata
.
All the other properties of the component's ViewMetadata
are preserved.
overrideView(componentType: Type, view: ViewMetadata) : TestComponentBuilder
Overrides a component's ViewMetadata
.
overrideDirective(componentType: Type, from: Type, to: Type) : TestComponentBuilder
Overrides the directives from the component ViewMetadata
.
overrideProviders(type: Type, providers: any[]) : TestComponentBuilder
Overrides one or more injectables configured via providers
metadata property of a directive
or
component.
Very useful when certain providers need to be mocked out.
The providers specified via this method are appended to the existing providers
causing the
duplicated providers to
be overridden.
overrideViewProviders(type: Type, providers: any[]) : TestComponentBuilder
Overrides one or more injectables configured via providers
metadata property of a directive
or
component.
Very useful when certain providers need to be mocked out.
The providers specified via this method are appended to the existing providers
causing the
duplicated providers to
be overridden.
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]) : TestComponentBuilder
createFromFactory(ngZone: NgZone, componentFactory: ComponentFactory<C>) : ComponentFixture<C>
createAsync(rootComponentType: ConcreteType<T>) : Promise<ComponentFixture<T>>
Builds and returns a ComponentFixture.
createFakeAsync(rootComponentType: ConcreteType<T>) : ComponentFixture<T>
createSync(rootComponentType: ConcreteType<T>) : ComponentFixture<T>
exported from @angular/core/testing defined in @angular/core/testing/test_component_builder.ts (line 17)