Skip to content

Commit

Permalink
test(compiler-cli): fix and re-enable compliance source-map tests (#4…
Browse files Browse the repository at this point in the history
…0040)

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
  • Loading branch information
petebacondarwin authored and mhevery committed Dec 9, 2020
1 parent 42d478b commit 85760cb
Show file tree
Hide file tree
Showing 25 changed files with 437 additions and 75 deletions.

Large diffs are not rendered by default.

@@ -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="
Expand Down
Expand Up @@ -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 = '';
}
@@ -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="
Expand Down
Expand Up @@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<div i18n>Hello, {{name}}!</div>',
})
export class TestCmp {
name: string = '';
}
Expand Up @@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<div [class.initial]="isInitial">Message</div>',
})
export class TestCmp {
isInitial: boolean = true;
}
@@ -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"
Expand Up @@ -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 = '';
}
@@ -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>'
@@ -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"
Expand Up @@ -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 = '';
}
@@ -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>'
@@ -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"
Expand Up @@ -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 = '';
}
@@ -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>'
Expand Up @@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<h3>Hello {{ name }}</h3>',
})
export class TestCmp {
name: string = '';
}
Expand Up @@ -5,4 +5,6 @@ import {Component} from '@angular/core';
template: '<h2>{{ greeting + " " + name }}</h2>',
})
export class TestCmp {
greeting: string = '';
name: string = '';
}
Expand Up @@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<div id="{{name}}"></div>',
})
export class TestCmp {
name: string = '';
}
@@ -1,8 +1,17 @@
import {Component} from '@angular/core';
import {Component, NgModule, Pipe, PipeTransform} from '@angular/core';

@Component({
selector: 'test-cmp',
template: '<div>{{200.3 | percent : 2 }}</div>',
})
export class TestCmp {
}

@Pipe({name: 'percent'})
export class PercentPipe implements PipeTransform {
transform() {}
}

@NgModule({declarations: [TestCmp, PercentPipe]})
export class AppModule {
}
Expand Up @@ -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[] = [];
}
Expand Up @@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<button on-click="doSomething()">Do it</button>',
})
export class TestCmp {
doSomething() {}
}
Expand Up @@ -5,4 +5,5 @@ import {Component} from '@angular/core';
template: '<button (click)="doSomething()">Do it</button>',
})
export class TestCmp {
doSomething() {}
}
@@ -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 {
}
@@ -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 {
}

0 comments on commit 85760cb

Please sign in to comment.