fix(ivy): add missing exportAs field to ngDirectiveDef (#25392)

This commit includes the missing exportAs field from @Directive and
propagates it into the ngDirectiveDef.

PR Close #25392
This commit is contained in:
Alex Rickabaugh
2018-08-06 09:56:43 +02:00
committed by Ben Lesh
parent 5be186035f
commit 6f085f8610
5 changed files with 42 additions and 1 deletions

View File

@ -604,6 +604,26 @@ describe('ngtsc behavioral tests', () => {
expect(jsContents).not.toMatch(/import \* as i[0-9] from ['"].\/test['"]/);
});
it('should generate exportAs declarations', () => {
writeConfig();
write('test.ts', `
import {Component, Directive} from '@angular/core';
@Directive({
selector: '[test]',
exportAs: 'foo',
})
class Dir {}
`);
const exitCode = main(['-p', basePath], errorSpy);
expect(errorSpy).not.toHaveBeenCalled();
expect(exitCode).toBe(0);
const jsContents = getContents('test.js');
expect(jsContents).toContain(`exportAs: "foo"`);
});
it('should generate correct factory stubs for a test module', () => {
writeConfig({'allowEmptyCodegenFiles': true});