test(ivy): normalize template names in canonical spec (#21815)

PR Close #21815
This commit is contained in:
Kara Erickson 2018-01-26 15:00:54 -08:00 committed by Miško Hevery
parent a751649c8d
commit d9ae70c699
1 changed files with 9 additions and 5 deletions

View File

@ -686,7 +686,7 @@ describe('compiler specification', () => {
@Component({selector: 'lifecycle-comp', template: ``}) @Component({selector: 'lifecycle-comp', template: ``})
class LifecycleComp { class LifecycleComp {
@Input() nameMin: string; @Input('name') nameMin: string;
ngOnChanges() { events.push('changes' + this.nameMin); } ngOnChanges() { events.push('changes' + this.nameMin); }
@ -701,14 +701,16 @@ describe('compiler specification', () => {
ngOnDestroy() { events.push(this.nameMin); } ngOnDestroy() { events.push(this.nameMin); }
// NORMATIVE
static ngComponentDef = r3.defineComponent({ static ngComponentDef = r3.defineComponent({
type: LifecycleComp, type: LifecycleComp,
tag: 'lifecycle-comp', tag: 'lifecycle-comp',
factory: () => new LifecycleComp(), factory: function LifecycleComp_Factory() { return new LifecycleComp(); },
template: function(ctx: any, cm: boolean) {}, template: function LifecycleComp_Template(ctx: LifecycleComp, cm: boolean) {},
inputs: {nameMin: 'name'}, inputs: {nameMin: 'name'},
features: [r3.NgOnChangesFeature] features: [r3.NgOnChangesFeature]
}); });
// /NORMATIVE
} }
@Component({ @Component({
@ -722,11 +724,12 @@ describe('compiler specification', () => {
name1 = '1'; name1 = '1';
name2 = '2'; name2 = '2';
// NORMATIVE
static ngComponentDef = r3.defineComponent({ static ngComponentDef = r3.defineComponent({
type: SimpleLayout, type: SimpleLayout,
tag: 'simple-layout', tag: 'simple-layout',
factory: () => simpleLayout = new SimpleLayout(), factory: function SimpleLayout_Factory() { return simpleLayout = new SimpleLayout(); },
template: function(ctx: any, cm: boolean) { template: function SimpleLayout_Template(ctx: SimpleLayout, cm: boolean) {
if (cm) { if (cm) {
r3.E(0, LifecycleComp); r3.E(0, LifecycleComp);
r3.e(); r3.e();
@ -741,6 +744,7 @@ describe('compiler specification', () => {
r3.r(3, 2); r3.r(3, 2);
} }
}); });
// /NORMATIVE
} }
it('should gen hooks with a few simple components', () => { it('should gen hooks with a few simple components', () => {