Title

Experimental Class Class Overview class Title { getTitle() : string setTitle(newTitle: string) } Class Description A service that can be used to get and set the title of a current HTML document. Since an Angular 2 application can't be bootstrapped on the entire HTML document (<html> tag) it is not possible to bind to the text property of the HTMLTitleElement elements (representing the <title> tag). Instead, this service can be used to set and get the current title value.

tick()

Experimental Function Class Export export tick(millis?: number) : void Simulates the asynchronous passage of time for the timers in the fakeAsync zone. The microtasks queue is drained at the very start of this function and after any timer callback has been executed. Example describe('this test', () => { it('looks async but is synchronous', <any>fakeAsync((): void => { var flag = false; setTimeout(() => { flag = true; }, 100); expect(flag).toBe(false);

TestModuleMetadata

Experimental Type-alias Interface Overview interface TestModuleMetadata { } Interface Description exported from @angular/core/testing/index, defined in @angular/core/testing/test_bed.ts

Testing

Techniques and practices for testing an Angular 2 app This chapter offers tips and techniques for testing Angular applications. Along the way you will learn some general testing principles and techniques but the focus is on Angular testing. Contents Introduction to Angular Testing Setup The first karma test The Angular Testing Platform (ATP) The sample application and its tests A simple component test Test a component with a service dependency Test a component with an async service Test a comp

TestComponentRenderer

Experimental Class Class Overview class TestComponentRenderer { insertRootElement(rootElementId: string) } Class Description An abstract class for inserting the root test component element in a platform independent way. Class Details insertRootElement(rootElementId: string) exported from @angular/core/testing/index, defined in @angular/core/testing/test_bed.ts

TestBed

Experimental Class Class Overview class TestBed { staticinitTestEnvironment(ngModule: Type<any>, platform: PlatformRef) : TestBed staticresetTestEnvironment() staticresetTestingModule() : typeof TestBed staticconfigureCompiler(config: {providers?: any[]; useJit?: boolean;}) : typeof TestBed staticconfigureTestingModule(moduleDef: TestModuleMetadata) : typeof TestBed staticcompileComponents() : Promise<any> staticoverrideModule(ngModule: Type<any>, override: Me

TestabilityRegistry

Experimental Class Class Overview class TestabilityRegistry { constructor() registerApplication(token: any, testability: Testability) getTestability(elem: any) : Testability getAllTestabilities() : Testability[] getAllRootElements() : any[] findTestabilityInTree(elem: Node, findInAncestors?: boolean) : Testability } Class Description A global registry of Testability instances for specific elements. Annotations @Injectable() Constructor constructor() Class Details re

Testability

Experimental Class Class Overview class Testability { constructor(_ngZone: NgZone) increasePendingRequestCount() : number decreasePendingRequestCount() : number isStable() : boolean whenStable(callback: Function) : void getPendingRequestCount() : number findBindings(using: any, provider: string, exactMatch: boolean) : any[] findProviders(using: any, provider: string, exactMatch: boolean) : any[] } Class Description The Testability service provides testing hooks that c

TemplateRef

Stable Class Class Overview class TemplateRef { C elementRef : ElementRef createEmbeddedView(context: C) : EmbeddedViewRef<C> } Class Description Represents an Embedded Template that can be used to instantiate Embedded Views. You can access a TemplateRef, in two ways. Via a directive placed on a <template> element (or directive prefixed with *) and have the TemplateRef for this Embedded View injected into the constructor of the directive using the TemplateRef Token. Alte

SystemJsNgModuleLoaderConfig

Experimental Class Class Overview class SystemJsNgModuleLoaderConfig { factoryPathPrefix : string factoryPathSuffix : string } Class Description Configuration for SystemJsNgModuleLoader. token. Class Details factoryPathPrefix : string Prefix to add when computing the name of the factory module for a given module name. factoryPathSuffix : string Suffix to add when computing the name of the factory module for a given module name. exported from @angular/core/index, defined in @angular