@ -39,7 +39,9 @@ export class TestingCompilerImpl implements TestingCompiler {
|
||||
constructor(
|
||||
private _compiler: CompilerImpl, private _directiveResolver: MockDirectiveResolver,
|
||||
private _pipeResolver: MockPipeResolver, private _moduleResolver: MockNgModuleResolver) {}
|
||||
get injector(): Injector { return this._compiler.injector; }
|
||||
get injector(): Injector {
|
||||
return this._compiler.injector;
|
||||
}
|
||||
|
||||
compileModuleSync<T>(moduleType: Type<T>): NgModuleFactory<T> {
|
||||
return this._compiler.compileModuleSync(moduleType);
|
||||
@ -78,14 +80,14 @@ export class TestingCompilerImpl implements TestingCompiler {
|
||||
this.checkOverrideAllowed(directive);
|
||||
const oldMetadata = this._directiveResolver.resolve(directive, false);
|
||||
this._directiveResolver.setDirective(
|
||||
directive, this._overrider.overrideMetadata(Directive, oldMetadata !, override));
|
||||
directive, this._overrider.overrideMetadata(Directive, oldMetadata!, override));
|
||||
this.clearCacheFor(directive);
|
||||
}
|
||||
overrideComponent(component: Type<any>, override: MetadataOverride<Component>): void {
|
||||
this.checkOverrideAllowed(component);
|
||||
const oldMetadata = this._directiveResolver.resolve(component, false);
|
||||
this._directiveResolver.setDirective(
|
||||
component, this._overrider.overrideMetadata(Component, oldMetadata !, override));
|
||||
component, this._overrider.overrideMetadata(Component, oldMetadata!, override));
|
||||
this.clearCacheFor(component);
|
||||
}
|
||||
overridePipe(pipe: Type<any>, override: MetadataOverride<Pipe>): void {
|
||||
@ -94,11 +96,19 @@ export class TestingCompilerImpl implements TestingCompiler {
|
||||
this._pipeResolver.setPipe(pipe, this._overrider.overrideMetadata(Pipe, oldMetadata, override));
|
||||
this.clearCacheFor(pipe);
|
||||
}
|
||||
loadAotSummaries(summaries: () => any[]) { this._compiler.loadAotSummaries(summaries); }
|
||||
clearCache(): void { this._compiler.clearCache(); }
|
||||
clearCacheFor(type: Type<any>) { this._compiler.clearCacheFor(type); }
|
||||
loadAotSummaries(summaries: () => any[]) {
|
||||
this._compiler.loadAotSummaries(summaries);
|
||||
}
|
||||
clearCache(): void {
|
||||
this._compiler.clearCache();
|
||||
}
|
||||
clearCacheFor(type: Type<any>) {
|
||||
this._compiler.clearCacheFor(type);
|
||||
}
|
||||
|
||||
getComponentFromError(error: Error) { return (error as any)[ERROR_COMPONENT_TYPE] || null; }
|
||||
getComponentFromError(error: Error) {
|
||||
return (error as any)[ERROR_COMPONENT_TYPE] || null;
|
||||
}
|
||||
|
||||
getModuleId(moduleType: Type<any>): string|undefined {
|
||||
return this._moduleResolver.resolve(moduleType, true).id;
|
||||
|
@ -15,7 +15,9 @@ import {TestComponentRenderer} from '@angular/core/testing';
|
||||
*/
|
||||
@Injectable()
|
||||
export class DOMTestComponentRenderer extends TestComponentRenderer {
|
||||
constructor(@Inject(DOCUMENT) private _doc: any) { super(); }
|
||||
constructor(@Inject(DOCUMENT) private _doc: any) {
|
||||
super();
|
||||
}
|
||||
|
||||
insertRootElement(rootElId: string) {
|
||||
const template = getDOM().getDefaultDocument().createElement('template');
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {COMPILER_OPTIONS, CompilerFactory, Injector, PlatformRef, createPlatformFactory} from '@angular/core';
|
||||
import {COMPILER_OPTIONS, CompilerFactory, createPlatformFactory, Injector, PlatformRef} from '@angular/core';
|
||||
import {ɵTestingCompilerFactory as TestingCompilerFactory} from '@angular/core/testing';
|
||||
import {ɵplatformCoreDynamic as platformCoreDynamic} from '@angular/platform-browser-dynamic';
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {NgModule, PlatformRef, StaticProvider, createPlatformFactory} from '@angular/core';
|
||||
import {createPlatformFactory, NgModule, PlatformRef, StaticProvider} from '@angular/core';
|
||||
import {TestComponentRenderer} from '@angular/core/testing';
|
||||
import {ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS as INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS} from '@angular/platform-browser-dynamic';
|
||||
import {BrowserTestingModule} from '@angular/platform-browser/testing';
|
||||
|
Reference in New Issue
Block a user