259 lines
8.2 KiB
Markdown
Raw Permalink Normal View History

## API Report File for "@angular/core_testing"
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
```ts
import { ChangeDetectorRef } from '@angular/core';
import { Component } from '@angular/core';
import { ComponentRef } from '@angular/core';
import { DebugElement } from '@angular/core';
import { Directive } from '@angular/core';
import { ElementRef } from '@angular/core';
import { InjectFlags } from '@angular/core';
import { InjectionToken } from '@angular/core';
import { NgModule } from '@angular/core';
import { NgZone } from '@angular/core';
import { Pipe } from '@angular/core';
import { PlatformRef } from '@angular/core';
import { ProviderToken } from '@angular/core';
import { SchemaMetadata } from '@angular/core';
import { Type } from '@angular/core';
// @public
export const __core_private_testing_placeholder__ = "";
// @public @deprecated (undocumented)
export function async(fn: Function): (done: any) => any;
// @public
export class ComponentFixture<T> {
constructor(componentRef: ComponentRef<T>, ngZone: NgZone | null, _autoDetect: boolean);
autoDetectChanges(autoDetect?: boolean): void;
changeDetectorRef: ChangeDetectorRef;
checkNoChanges(): void;
componentInstance: T;
// (undocumented)
componentRef: ComponentRef<T>;
debugElement: DebugElement;
destroy(): void;
detectChanges(checkNoChanges?: boolean): void;
elementRef: ElementRef;
isStable(): boolean;
nativeElement: any;
// (undocumented)
ngZone: NgZone | null;
whenRenderingDone(): Promise<any>;
whenStable(): Promise<any>;
}
// @public (undocumented)
export const ComponentFixtureAutoDetect: InjectionToken<boolean[]>;
// @public (undocumented)
export const ComponentFixtureNoNgZone: InjectionToken<boolean[]>;
// @public
export function discardPeriodicTasks(): void;
// @public
export function fakeAsync(fn: Function): (...args: any[]) => any;
// @public
export function flush(maxTurns?: number): number;
// @public
export function flushMicrotasks(): void;
// @public
export const getTestBed: () => TestBed;
// @public
export function inject(tokens: any[], fn: Function): () => any;
// @public (undocumented)
export class InjectSetupWrapper {
2016-07-29 04:19:02 -07:00
constructor(_moduleDef: () => TestModuleMetadata);
// (undocumented)
inject(tokens: any[], fn: Function): () => any;
}
// @public
export type MetadataOverride<T> = {
add?: Partial<T>;
remove?: Partial<T>;
set?: Partial<T>;
2016-07-29 04:19:02 -07:00
};
// @public
export interface ModuleTeardownOptions {
destroyAfterEach: boolean;
rethrowErrors?: boolean;
}
// @public
export function resetFakeAsyncZone(): void;
// @public (undocumented)
export interface TestBed {
// (undocumented)
compileComponents(): Promise<any>;
// (undocumented)
configureCompiler(config: {
providers?: any[];
useJit?: boolean;
}): void;
// (undocumented)
configureTestingModule(moduleDef: TestModuleMetadata): void;
// (undocumented)
createComponent<T>(component: Type<T>): ComponentFixture<T>;
// (undocumented)
execute(tokens: any[], fn: Function, context?: any): any;
// @deprecated (undocumented)
get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
// @deprecated (undocumented)
get(token: any, notFoundValue?: any): any;
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): void;
// (undocumented)
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): void;
// (undocumented)
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
// (undocumented)
inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null;
// (undocumented)
ngModule: Type<any> | Type<any>[];
// (undocumented)
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): void;
// (undocumented)
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): void;
// (undocumented)
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModule>): void;
// (undocumented)
overridePipe(pipe: Type<any>, override: MetadataOverride<Pipe>): void;
overrideProvider(token: any, provider: {
useFactory: Function;
deps: any[];
}): void;
// (undocumented)
overrideProvider(token: any, provider: {
useValue: any;
}): void;
// (undocumented)
overrideProvider(token: any, provider: {
useFactory?: Function;
useValue?: any;
deps?: any[];
}): void;
// (undocumented)
overrideTemplateUsingTestingModule(component: Type<any>, template: string): void;
// (undocumented)
platform: PlatformRef;
resetTestEnvironment(): void;
// (undocumented)
resetTestingModule(): void;
}
// @public
export const TestBed: TestBedStatic;
// @public
export interface TestBedStatic {
// (undocumented)
new (...args: any[]): TestBed;
compileComponents(): Promise<any>;
configureCompiler(config: {
providers?: any[];
useJit?: boolean;
}): TestBedStatic;
configureTestingModule(moduleDef: TestModuleMetadata): TestBedStatic;
// (undocumented)
createComponent<T>(component: Type<T>): ComponentFixture<T>;
// @deprecated (undocumented)
get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any;
// @deprecated (undocumented)
get(token: any, notFoundValue?: any): any;
// (undocumented)
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: {
teardown?: ModuleTeardownOptions;
}): TestBed;
// (undocumented)
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, aotSummaries?: () => any[]): TestBed;
// (undocumented)
inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
// (undocumented)
inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null;
// (undocumented)
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): TestBedStatic;
// (undocumented)
overrideDirective(directive: Type<any>, override: MetadataOverride<Directive>): TestBedStatic;
// (undocumented)
overrideModule(ngModule: Type<any>, override: MetadataOverride<NgModule>): TestBedStatic;
// (undocumented)
overridePipe(pipe: Type<any>, override: MetadataOverride<Pipe>): TestBedStatic;
overrideProvider(token: any, provider: {
useFactory: Function;
deps: any[];
}): TestBedStatic;
// (undocumented)
overrideProvider(token: any, provider: {
useValue: any;
}): TestBedStatic;
// (undocumented)
overrideProvider(token: any, provider: {
useFactory?: Function;
useValue?: any;
deps?: any[];
}): TestBedStatic;
// (undocumented)
overrideTemplate(component: Type<any>, template: string): TestBedStatic;
overrideTemplateUsingTestingModule(component: Type<any>, template: string): TestBedStatic;
resetTestEnvironment(): void;
// (undocumented)
resetTestingModule(): TestBedStatic;
}
// @public
export class TestComponentRenderer {
// (undocumented)
insertRootElement(rootElementId: string): void;
// (undocumented)
removeAllRootElements?(): void;
}
// @public (undocumented)
export interface TestEnvironmentOptions {
// (undocumented)
aotSummaries?: () => any[];
// (undocumented)
teardown?: ModuleTeardownOptions;
}
// @public (undocumented)
export type TestModuleMetadata = {
feat(testing): add implicit test module Every test now has an implicit module. It can be configured via `configureModule` (from @angular/core/testing) to add providers, directives, pipes, ... The compiler now has to be configured separately via `configureCompiler` (from @angular/core/testing) to add providers or define whether to use jit. BREAKING CHANGE: - Application providers can no longer inject compiler internals (i.e. everything from `@angular/compiler). Inject `Compiler` instead. This reflects the changes to `bootstrap` for module support (3f55aa609f60f130f1d69188ed057214b1267cb3). - Compiler providers can no longer be added via `addProviders` / `withProviders`. Use the new method `configureCompiler` instead. - Platform directives / pipes need to be provided via `configureModule` and can no longer be provided via the `PLATFORM_PIPES` / `PLATFORM_DIRECTIVES` tokens. - `setBaseTestProviders()` was renamed into `initTestEnvironment` and now takes a `PlatformRef` and a factory for a `Compiler`. - E.g. for the browser platform: BEFORE: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’; setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS); ``` AFTER: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {browserTestCompiler, browserDynamicTestPlatform, BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’; initTestEnvironment( browserTestCompiler, browserDynamicTestPlatform(), BrowserDynamicTestModule); ``` - E.g. for the server platform: BEFORE: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {TEST_SERVER_PLATFORM_PROVIDERS, TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’; setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS, TEST_SERVER_APPLICATION_PROVIDERS); ``` AFTER: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {serverTestCompiler, serverTestPlatform, ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’; initTestEnvironment( serverTestCompiler, serverTestPlatform(), ServerTestModule); ``` Related to #9726 Closes #9846
2016-07-04 09:37:30 -07:00
providers?: any[];
declarations?: any[];
imports?: any[];
schemas?: Array<SchemaMetadata | any[]>;
aotSummaries?: () => any[];
teardown?: ModuleTeardownOptions;
2016-07-29 04:19:02 -07:00
};
// @public
export function tick(millis?: number, tickOptions?: {
processNewMacroTasksSynchronously: boolean;
}): void;
feat(testing): add implicit test module Every test now has an implicit module. It can be configured via `configureModule` (from @angular/core/testing) to add providers, directives, pipes, ... The compiler now has to be configured separately via `configureCompiler` (from @angular/core/testing) to add providers or define whether to use jit. BREAKING CHANGE: - Application providers can no longer inject compiler internals (i.e. everything from `@angular/compiler). Inject `Compiler` instead. This reflects the changes to `bootstrap` for module support (3f55aa609f60f130f1d69188ed057214b1267cb3). - Compiler providers can no longer be added via `addProviders` / `withProviders`. Use the new method `configureCompiler` instead. - Platform directives / pipes need to be provided via `configureModule` and can no longer be provided via the `PLATFORM_PIPES` / `PLATFORM_DIRECTIVES` tokens. - `setBaseTestProviders()` was renamed into `initTestEnvironment` and now takes a `PlatformRef` and a factory for a `Compiler`. - E.g. for the browser platform: BEFORE: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS} from ‘@angular/platform-browser-dynamic/testing’; setBaseTestProviders(TEST_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, TEST_BROWSER_DYNAMIC_APPLICATION_PROVIDERS); ``` AFTER: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {browserTestCompiler, browserDynamicTestPlatform, BrowserDynamicTestModule} from ‘@angular/platform-browser-dynamic/testing’; initTestEnvironment( browserTestCompiler, browserDynamicTestPlatform(), BrowserDynamicTestModule); ``` - E.g. for the server platform: BEFORE: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {TEST_SERVER_PLATFORM_PROVIDERS, TEST_SERVER_APPLICATION_PROVIDERS} from ‘@angular/platform-server/testing/server’; setBaseTestProviders(TEST_SERVER_PLATFORM_PROVIDERS, TEST_SERVER_APPLICATION_PROVIDERS); ``` AFTER: ``` import {setBaseTestProviders} from ‘@angular/core/testing’; import {serverTestCompiler, serverTestPlatform, ServerTestModule} from ‘@angular/platform-browser-dynamic/testing’; initTestEnvironment( serverTestCompiler, serverTestPlatform(), ServerTestModule); ``` Related to #9726 Closes #9846
2016-07-04 09:37:30 -07:00
// @public
export function waitForAsync(fn: Function): (done: any) => any;
// @public (undocumented)
export function withModule(moduleDef: TestModuleMetadata): InjectSetupWrapper;
// @public (undocumented)
export function withModule(moduleDef: TestModuleMetadata, fn: Function): () => any;
// (No @packageDocumentation comment for this package)
```