test(compiler-cli): fix and re-enable compliance source-map tests (#40040)

These tests started failing because they had type-check
errors in their templates, and a recent commit turned on
full template type-checking by default.\

This commit fixes those templates and updates the expected
files as necessary.

PR Close #40040
This commit is contained in:
Pete Bacon Darwin 2020-12-09 12:52:04 +00:00 committed by Misko Hevery
parent 42d478b16a
commit 85760cb170
25 changed files with 464 additions and 102 deletions

View File

@ -1,9 +1,9 @@
$localize ` pre-title ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{title_value}}
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{titleValue}}
}:INTERPOLATION: post-title` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-title
$localize ` pre-body ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{body_value}}
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{bodyValue}}
}:INTERPOLATION: post-body` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-body
i0.ɵɵelementStart(0, "div", 0) // SOURCE: "/i18n_message_interpolation_whitespace.ts" <div i18n title="

View File

@ -3,7 +3,9 @@ import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template:
'<div i18n title=" pre-title {{title_value}} post-title" i18n-title> pre-body {{body_value}} post-body</div>',
'<div i18n title=" pre-title {{titleValue}} post-title" i18n-title> pre-body {{bodyValue}} post-body</div>',
})
export class TestCmp {
titleValue: string = '';
bodyValue: string = '';
}

View File

@ -1,9 +1,9 @@
$localize ` pre-title ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{title_value}}
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{titleValue}}
}:INTERPOLATION: post-title` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-title" i18n-title>
$localize ` pre-body ${
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{body_value}}
"\uFFFD0\uFFFD" // SOURCE: "/i18n_message_interpolation_whitespace.ts" {{bodyValue}}
}:INTERPOLATION: post-body` // SOURCE: "/i18n_message_interpolation_whitespace.ts" post-body
.ɵɵelementStart(0, "div", 0) // SOURCE: "/i18n_message_interpolation_whitespace.ts" <div i18n title="

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<div i18n>Hello, {{name}}!</div>',
})
export class TestCmp {
name: string = '';
}

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<div [class.initial]="isInitial">Message</div>',
})
export class TestCmp {
isInitial: boolean = true;
}

View File

@ -1,3 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_complex.ts" <div
i0.ɵɵproperty("attr", ctx.greeting + ctx.name) // SOURCE: "/input_binding_complex.ts" [attr]="greeting + name"
i0.ɵɵproperty("title", ctx.greeting + ctx.name) // SOURCE: "/input_binding_complex.ts" [title]="greeting + name"

View File

@ -2,7 +2,9 @@ import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div [attr]="greeting + name"></div>',
template: '<div [title]="greeting + name"></div>',
})
export class TestCmp {
greeting: string = '';
name: string = '';
}

View File

@ -1,4 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_complex.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵproperty("attr", ctx.greeting // SOURCE: "/input_binding_complex.ts" [attr]="greeting + name"></div>'
.ɵɵproperty("title", ctx.greeting // SOURCE: "/input_binding_complex.ts" [title]="greeting + name"></div>'

View File

@ -1,3 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_longhand.ts" <div
i0.ɵɵproperty("attr", ctx.name) // SOURCE: "/input_binding_longhand.ts" bind-attr="name"
i0.ɵɵproperty("title", ctx.name) // SOURCE: "/input_binding_longhand.ts" bind-title="name"

View File

@ -2,7 +2,8 @@ import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div bind-attr="name"></div>',
template: '<div bind-title="name"></div>',
})
export class TestCmp {
name: string = '';
}

View File

@ -1,4 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_longhand.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵproperty("attr", ctx. // SOURCE: "/input_binding_longhand.ts" bind-attr="name"></div>'
.ɵɵproperty("title", ctx. // SOURCE: "/input_binding_longhand.ts" bind-title="name"></div>'

View File

@ -1,3 +1,3 @@
i0.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_simple.ts" <div
i0.ɵɵproperty("attr", ctx.name) // SOURCE: "/input_binding_simple.ts" [attr]="name"
i0.ɵɵproperty("title", ctx.name) // SOURCE: "/input_binding_simple.ts" [title]="name"

View File

@ -2,7 +2,8 @@ import {Component} from '@angular/core';
@Component({
selector: 'test-cmp',
template: '<div [attr]="name"></div>',
template: '<div [title]="name"></div>',
})
export class TestCmp {
name: string = '';
}

View File

@ -1,4 +1,4 @@
.ɵɵelement(0, "div", 0) // SOURCE: "/input_binding_simple.ts" <div
// TODO: Work out how to fix the broken segment for the last item in a template
.ɵɵproperty("attr", c // SOURCE: "/input_binding_simple.ts" [attr]="name"></div>'
.ɵɵproperty("title", c // SOURCE: "/input_binding_simple.ts" [title]="name"></div>'

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<h3>Hello {{ name }}</h3>',
})
export class TestCmp {
name: string = '';
}

View File

@ -5,4 +5,6 @@ import {Component} from '@angular/core';
template: '<h2>{{ greeting + " " + name }}</h2>',
})
export class TestCmp {
greeting: string = '';
name: string = '';
}

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<div id="{{name}}"></div>',
})
export class TestCmp {
name: string = '';
}

View File

@ -1,4 +1,4 @@
import {Component} from '@angular/core';
import {Component, NgModule, Pipe, PipeTransform} from '@angular/core';
@Component({
selector: 'test-cmp',
@ -6,3 +6,12 @@ import {Component} from '@angular/core';
})
export class TestCmp {
}
@Pipe({name: 'percent'})
export class PercentPipe implements PipeTransform {
transform() {}
}
@NgModule({declarations: [TestCmp, PercentPipe]})
export class AppModule {
}

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: `<button (click)="items.push('item' + items.length)">Add Item</button>`,
})
export class TestCmp {
items: string[] = [];
}

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<button on-click="doSomething()">Do it</button>',
})
export class TestCmp {
doSomething() {}
}

View File

@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<button (click)="doSomething()">Do it</button>',
})
export class TestCmp {
doSomething() {}
}

View File

@ -1,8 +1,19 @@
import {Component} from '@angular/core';
import {Component, Directive, EventEmitter, Input, NgModule, Output} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input bindon-ngModel="name">',
})
export class TestCmp {
name: string = '';
}
@Directive({selector: '[ngModel]'})
export class NgModelDirective {
@Input() ngModel: string = '';
@Output() ngModelChanges: EventEmitter<string> = new EventEmitter();
}
@NgModule({declarations: [TestCmp, NgModelDirective]})
export class AppModule {
}

View File

@ -1,8 +1,19 @@
import {Component} from '@angular/core';
import {Component, Directive, EventEmitter, Input, NgModule, Output} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input [(ngModel)]="name">',
})
export class TestCmp {
name: string = '';
}
@Directive({selector: '[ngModel]'})
export class NgModelDirective {
@Input() ngModel: string = '';
@Output() ngModelChanges: EventEmitter<string> = new EventEmitter();
}
@NgModule({declarations: [TestCmp, NgModelDirective]})
export class AppModule {
}