bf598d6b8b
Adds new abstraction `Compiler` with methods `compileComponentAsync` and `compileComponentSync`. This is in preparation of deprecating `ComponentResolver`. `compileComponentSync` is able to compile components synchronously given all components either have an inline template or they have been compiled before. Also changes `TestComponentBuilder.createSync` to take a `Type` and use the new `compileComponentSync` method. Also supports overriding the component metadata even if the component has already been compiled. Also fixes #7084 in a better way. BREAKING CHANGE: `TestComponentBuilder.createSync` now takes a component type and throws if not all templates are either inlined are compiled before via `createAsync`. Closes #9594
45 lines
2.0 KiB
TypeScript
45 lines
2.0 KiB
TypeScript
export declare class MockDirectiveResolver extends DirectiveResolver {
|
|
constructor(_injector: Injector);
|
|
resolve(type: Type): DirectiveMetadata;
|
|
setProvidersOverride(type: Type, providers: any[]): void;
|
|
setViewProvidersOverride(type: Type, viewProviders: any[]): void;
|
|
}
|
|
|
|
export declare class MockSchemaRegistry implements ElementSchemaRegistry {
|
|
attrPropMapping: {
|
|
[key: string]: string;
|
|
};
|
|
existingProperties: {
|
|
[key: string]: boolean;
|
|
};
|
|
constructor(existingProperties: {
|
|
[key: string]: boolean;
|
|
}, attrPropMapping: {
|
|
[key: string]: string;
|
|
});
|
|
getMappedPropName(attrName: string): string;
|
|
hasProperty(tagName: string, property: string): boolean;
|
|
securityContext(tagName: string, property: string): SecurityContext;
|
|
}
|
|
|
|
export declare class MockViewResolver extends ViewResolver {
|
|
constructor(_injector: Injector);
|
|
overrideViewDirective(component: Type, from: Type, to: Type): void;
|
|
resolve(component: Type): ViewMetadata;
|
|
setAnimations(component: Type, animations: AnimationEntryMetadata[]): void;
|
|
setInlineTemplate(component: Type, template: string): void;
|
|
setView(component: Type, view: ViewMetadata): void;
|
|
}
|
|
|
|
export declare class OverridingTestComponentBuilder extends TestComponentBuilder {
|
|
constructor(injector: Injector);
|
|
createAsync<T>(rootComponentType: ConcreteType<T>): Promise<ComponentFixture<T>>;
|
|
createSync<T>(rootComponentType: ConcreteType<T>): ComponentFixture<T>;
|
|
overrideAnimations(componentType: Type, animations: AnimationEntryMetadata[]): TestComponentBuilder;
|
|
overrideDirective(componentType: Type, from: Type, to: Type): OverridingTestComponentBuilder;
|
|
overrideProviders(type: Type, providers: any[]): OverridingTestComponentBuilder;
|
|
overrideTemplate(componentType: Type, template: string): OverridingTestComponentBuilder;
|
|
overrideView(componentType: Type, view: ViewMetadata): OverridingTestComponentBuilder;
|
|
overrideViewProviders(type: Type, providers: any[]): OverridingTestComponentBuilder;
|
|
}
|