Class Overview
class TestBed {
initTestEnvironment
(ngModule: Type, platform: PlatformRef) : TestBed
resetTestEnvironment
()
resetTestingModule
() : typeof TestBed
configureCompiler
(config: {providers?: any[]; useJit?: boolean;}) : typeof TestBed
configureTestingModule
(moduleDef: TestModuleMetadata) : typeof TestBed
compileComponents
() : Promise<any>
overrideModule
(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>) : typeof TestBed
overrideComponent
(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>) : typeof TestBed
overrideDirective
(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>) : typeof TestBed
overridePipe
(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>) : typeof TestBed
createComponent
(component: ConcreteType<T>) : ComponentFixture<T>
initTestEnvironment
(ngModule: Type, platform: PlatformRef)
resetTestEnvironment
()
reset
()
resetTestingModule
()
platform
: PlatformRef
ngModule
: Type
configureCompiler
(config: {providers?: any[], useJit?: boolean})
configureTestingModule
(moduleDef: TestModuleMetadata)
compileComponents
() : Promise<any>
get
(token: any, notFoundValue?: any)
execute
(tokens: any[], fn: Function) : any
overrideModule
(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>) : void
overrideComponent
(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>) : void
overrideDirective
(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>) : void
overridePipe
(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>) : void
createComponent
(component: ConcreteType<T>) : ComponentFixture<T>
}
Class Description
Class Export
export class TestBed
Static Members
initTestEnvironment(ngModule: Type, platform: PlatformRef) : TestBed
Initialize the environment for testing with a compiler factory, a PlatformRef, and an angular module. These are common to every test in the suite.
This may only be called once, to set up the common providers for the current test
suite on the current platform. If you absolutely need to change the providers,
first use resetTestEnvironment
.
Test modules and platforms for individual platforms are available from
'angular2/platform/testing/
resetTestEnvironment()
Reset the providers for the test injector.
resetTestingModule() : typeof TestBed
configureCompiler(config: {providers?: any[]; useJit?: boolean;}) : typeof TestBed
Allows overriding default compiler providers and settings which are defined in test_injector.js
configureTestingModule(moduleDef: TestModuleMetadata) : typeof TestBed
Allows overriding default providers, directives, pipes, modules of the test injector, which are defined in test_injector.js
compileComponents() : Promise<any>
Compile components with a templateUrl
for the test's NgModule.
It is necessary to call this function
as fetching urls is asynchronous.
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>) : typeof TestBed
overrideComponent(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>) : typeof TestBed
overrideDirective(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>) : typeof TestBed
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>) : typeof TestBed
createComponent(component: ConcreteType<T>) : ComponentFixture<T>
Class Details
initTestEnvironment(ngModule: Type, platform: PlatformRef)
Initialize the environment for testing with a compiler factory, a PlatformRef, and an angular module. These are common to every test in the suite.
This may only be called once, to set up the common providers for the current test
suite on the current platform. If you absolutely need to change the providers,
first use resetTestEnvironment
.
Test modules and platforms for individual platforms are available from
'angular2/platform/testing/
resetTestEnvironment()
Reset the providers for the test injector.
reset()
resetTestingModule()
platform : PlatformRef
ngModule : Type
configureCompiler(config: {providers?: any[], useJit?: boolean})
configureTestingModule(moduleDef: TestModuleMetadata)
compileComponents() : Promise<any>
get(token: any, notFoundValue?: any)
execute(tokens: any[], fn: Function) : any
overrideModule(ngModule: ConcreteType<any>, override: MetadataOverride<NgModuleMetadataType>) : void
overrideComponent(component: ConcreteType<any>, override: MetadataOverride<ComponentMetadataType>) : void
overrideDirective(directive: ConcreteType<any>, override: MetadataOverride<DirectiveMetadataType>) : void
overridePipe(pipe: ConcreteType<any>, override: MetadataOverride<PipeMetadataType>) : void
createComponent(component: ConcreteType<T>) : ComponentFixture<T>
exported from @angular/core/testing defined in @angular/core/testing/test_bed.ts (line 47)