feat: add .ngsummary.ts files to support AOT unit tests
Design doc: https://docs.google.com/document/d/1VmTkz0EbEVSWfEEWEvQ5sXyQXSCvtMOw4t7pKU-jOwc/edit?usp=sharing
This commit is contained in:

committed by
Matias Niemelä

parent
2714644528
commit
547c363473
@ -0,0 +1 @@
|
||||
Hello world!
|
52
packages/compiler-cli/integrationtest/src/jit_summaries.ts
Normal file
52
packages/compiler-cli/integrationtest/src/jit_summaries.ts
Normal file
@ -0,0 +1,52 @@
|
||||
/**
|
||||
* @license
|
||||
* Copyright Google Inc. All Rights Reserved.
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {Component, Directive, Injectable, NgModule, Pipe} from '@angular/core';
|
||||
|
||||
const instances = new Map<any, Base>();
|
||||
|
||||
export function expectInstanceCreated(type: any) {
|
||||
const instance = instances.get(type) !;
|
||||
expect(instance).toBeDefined();
|
||||
expect(instance.dep instanceof SomeDep).toBe(true);
|
||||
}
|
||||
|
||||
export class SomeDep {}
|
||||
|
||||
export class Base {
|
||||
constructor(public dep: SomeDep) { instances.set(Object.getPrototypeOf(this).constructor, this); }
|
||||
}
|
||||
|
||||
@Component({templateUrl: './jit_summaries.html'})
|
||||
export class SomePrivateComponent extends Base {
|
||||
}
|
||||
|
||||
@Component({templateUrl: './jit_summaries.html'})
|
||||
export class SomePublicComponent extends Base {
|
||||
}
|
||||
|
||||
@Directive({selector: '[someDir]'})
|
||||
export class SomeDirective extends Base {
|
||||
}
|
||||
|
||||
@Pipe({name: 'somePipe'})
|
||||
export class SomePipe extends Base {
|
||||
transform(value: any) { return value; }
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
export class SomeService extends Base {
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
declarations: [SomePublicComponent, SomePrivateComponent, SomeDirective, SomePipe],
|
||||
exports: [SomeDirective, SomePipe, SomePublicComponent],
|
||||
providers: [SomeService]
|
||||
})
|
||||
export class SomeModule extends Base {
|
||||
}
|
@ -28,6 +28,9 @@ import {CompUsingRootModuleDirectiveAndPipe, SomeDirectiveInRootModule, SomeLibM
|
||||
import {CompWithNgContent, ProjectingComp} from './projection';
|
||||
import {CompForChildQuery, CompWithChildQuery, CompWithDirectiveChild, DirectiveForQuery} from './queries';
|
||||
|
||||
// Adding an export here so that TypeScript compiles the file as well
|
||||
export {SomeModule as JitSummariesSomeModule} from './jit_summaries';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
AnimateCmp,
|
||||
|
Reference in New Issue
Block a user