fix(compiler): avoid emitting self importing factories

Fixes: #17389
This commit is contained in:
Chuck Jazdzewski
2017-06-21 15:05:11 -07:00
committed by Hans
parent 34cc3f2982
commit 4352dd27c4
4 changed files with 36 additions and 5 deletions

View File

@ -233,6 +233,37 @@ describe('compiler (unbundled Angular)', () => {
};
compile([FILES, angularFiles], {postCompile: expectNoDiagnostics});
});
it('should not contain a self import in factory', () => {
const FILES: MockDirectory = {
app: {
'app.ts': `
import {Component, NgModule} from '@angular/core';
interface Person { name: string; }
@Component({
selector: 'my-comp',
template: '{{person.name}}'
})
export class MyComp {
person: Person;
}
@NgModule({
declarations: [MyComp]
})
export class MyModule {}
`
}
};
compile([FILES, angularFiles], {
postCompile: program => {
const factorySource = program.getSourceFile('/app/app.ngfactory.ts');
expect(factorySource.text).not.toContain('\'/app/app.ngfactory\'');
}
});
});
});
it('should add the preamble to generated files', () => {