feat(ivy): i18n compiler support for i18nStart and i18nEnd instructions (#26442)

PR Close #26442
This commit is contained in:
Andrew Kushnir
2018-10-12 14:34:38 -07:00
committed by Misko Hevery
parent 8024857d4c
commit 8a3fd58cad
8 changed files with 913 additions and 232 deletions

View File

@ -9,8 +9,6 @@
import {setup} from '@angular/compiler/test/aot/test_util';
import {compile, expectEmit} from './mock_compile';
const TRANSLATION_NAME_REGEXP = /^MSG_[A-Z0-9]+/;
describe('i18n support in the view compiler', () => {
const angularFiles = setup({
compileAngular: false,
@ -18,56 +16,7 @@ describe('i18n support in the view compiler', () => {
compileAnimations: false,
});
describe('single text nodes', () => {
it('should translate single text nodes with the i18n attribute', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div i18n>Hello world</div>
<div>&</div>
<div i18n>farewell</div>
<div i18n>farewell</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = `
const $msg_1$ = goog.getMsg("Hello world");
const $msg_2$ = goog.getMsg("farewell");
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵtext(1, $msg_1$);
$r3$.ɵtext(3,"&");
$r3$.ɵtext(5, $msg_2$);
$r3$.ɵtext(7, $msg_2$);
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template', {
'$msg_1$': TRANSLATION_NAME_REGEXP,
'$msg_2$': TRANSLATION_NAME_REGEXP,
});
});
describe('element attributes', () => {
it('should add the meaning and description as JsDoc comments', () => {
const files = {
app: {
@ -77,7 +26,12 @@ describe('i18n support in the view compiler', () => {
@Component({
selector: 'my-component',
template: \`
<div i18n="meaning|desc@@id" i18n-title="desc" title="introduction">Hello world</div>
<div i18n="meaningA|descA@@idA">Content A</div>
<div i18n-title="meaningB|descB@@idB" title="Title B">Content B</div>
<div i18n-title="meaningC" title="Title C">Content C</div>
<div i18n-title="meaningD|descD" title="Title D">Content D</div>
<div i18n-title="meaningE@@idE" title="Title E">Content E</div>
<div i18n-title="@@idF" title="Title F">Content F</div>
\`
})
export class MyComponent {}
@ -90,22 +44,63 @@ describe('i18n support in the view compiler', () => {
const template = `
/**
* @desc desc
* @desc [BACKUP_MESSAGE_ID:idA] descA
* @meaning meaningA
*/
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("introduction");
const $_c1$ = ["title", $MSG_APP_SPEC_TS_0$, 0];
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("Content A");
/**
* @desc desc
* @meaning meaning
* @desc [BACKUP_MESSAGE_ID:idB] descB
* @meaning meaningB
*/
const $MSG_APP_SPEC_TS_2$ = goog.getMsg("Hello world");
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("Title B");
const $_c2$ = ["title", $MSG_APP_SPEC_TS_1$, 0];
/**
* @desc meaningC
*/
const $MSG_APP_SPEC_TS_3$ = goog.getMsg("Title C");
const $_c4$ = ["title", $MSG_APP_SPEC_TS_3$, 0];
/**
* @desc descD
* @meaning meaningD
*/
const $MSG_APP_SPEC_TS_5$ = goog.getMsg("Title D");
const $_c6$ = ["title", $MSG_APP_SPEC_TS_5$, 0];
/**
* @desc [BACKUP_MESSAGE_ID:idE] meaningE
*/
const $MSG_APP_SPEC_TS_7$ = goog.getMsg("Title E");
const $_c8$ = ["title", $MSG_APP_SPEC_TS_7$, 0];
/**
* @desc [BACKUP_MESSAGE_ID:idF]
*/
const $MSG_APP_SPEC_TS_9$ = goog.getMsg("Title F");
const $_c10$ = ["title", $MSG_APP_SPEC_TS_9$, 0];
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵi18nAttribute(1, $_c1$);
$r3$text(2, $MSG_APP_SPEC_TS_2$);
$r3$.ɵi18nStart(1, $MSG_APP_SPEC_TS_0$);
$r3$i18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(2, "div");
$r3$.ɵi18nAttribute(3, $_c2$);
$r3$.ɵtext(4, "Content B");
$r3$.ɵelementEnd();
$r3$.ɵelementStart(5, "div");
$r3$.ɵi18nAttribute(6, $_c4$);
$r3$.ɵtext(7, "Content C");
$r3$.ɵelementEnd();
$r3$.ɵelementStart(8, "div");
$r3$.ɵi18nAttribute(9, $_c6$);
$r3$.ɵtext(10, "Content D");
$r3$.ɵelementEnd();
$r3$.ɵelementStart(11, "div");
$r3$.ɵi18nAttribute(12, $_c8$);
$r3$.ɵtext(13, "Content E");
$r3$.ɵelementEnd();
$r3$.ɵelementStart(14, "div");
$r3$.ɵi18nAttribute(15, $_c10$);
$r3$.ɵtext(16, "Content F");
$r3$.ɵelementEnd();
}
}
@ -114,9 +109,6 @@ describe('i18n support in the view compiler', () => {
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
});
describe('element attributes', () => {
it('should translate static attributes', () => {
const files = {
@ -127,7 +119,7 @@ describe('i18n support in the view compiler', () => {
@Component({
selector: 'my-component',
template: \`
<div i18n id="static" i18n-title="m|d" title="introduction"></div>
<div id="static" i18n-title="m|d" title="introduction"></div>
\`
})
export class MyComponent {}
@ -169,12 +161,12 @@ describe('i18n support in the view compiler', () => {
@Component({
selector: 'my-component',
template: \`
<div i18n id="dynamic-1"
<div id="dynamic-1"
i18n-title="m|d" title="intro {{ valueA | uppercase }}"
i18n-aria-label="m1|d1" aria-label="{{ valueB }}"
i18n-aria-roledescription aria-roledescription="static text"
></div>
<div i18n id="dynamic-2"
<div id="dynamic-2"
i18n-title="m2|d2" title="{{ valueA }} and {{ valueB }} and again {{ valueA + valueB }}"
i18n-aria-roledescription aria-roledescription="{{ valueC }}"
></div>
@ -184,7 +176,7 @@ describe('i18n support in the view compiler', () => {
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
`
}
};
@ -307,12 +299,12 @@ describe('i18n support in the view compiler', () => {
@Component({
selector: 'my-component',
template: \`
<div i18n id="dynamic-1"
<div id="dynamic-1"
i18n-title="m|d" title="intro {{ valueA | uppercase }}"
i18n-aria-label="m1|d1" aria-label="{{ valueB }}"
i18n-aria-roledescription aria-roledescription="static text"
></div>
<div i18n id="dynamic-2"
<div id="dynamic-2"
i18n-title="m2|d2" title="{{ valueA }} and {{ valueB }} and again {{ valueA + valueB }}"
i18n-aria-roledescription aria-roledescription="{{ valueC }}"
></div>
@ -437,9 +429,8 @@ describe('i18n support in the view compiler', () => {
});
});
// TODO(vicb): this feature is not supported yet
xdescribe('nested nodes', () => {
it('should generate the placeholders maps', () => {
describe('nested nodes', () => {
it('should not produce instructions for empty content', () => {
const files = {
app: {
'spec.ts': `
@ -448,24 +439,471 @@ describe('i18n support in the view compiler', () => {
@Component({
selector: 'my-component',
template: \`
<div i18n>Hello <b>{{name}}<i>!</i><i>!</i></b></div>
<div>Other</div>
<div i18n>2nd</div>
<div i18n><i>3rd</i></div>
<div i18n></div>
<div i18n> </div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
`
}
};
const template = `
const $r1$ = {"b":[2], "i":[4, 6]};
const $r2$ = {"i":[13]};
`;
const template = String.raw `
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelement(0, "div");
$r3$.ɵelement(1, "div");
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
it('should handle i18n attributes with plain-text content', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div i18n>My i18n block #1</div>
<div>My non-i18n block #1</div>
<div i18n>My i18n block #2</div>
<div>My non-i18n block #2</div>
<div i18n>My i18n block #3</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = String.raw `
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("My i18n block #1");
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("My i18n block #2");
const $MSG_APP_SPEC_TS_2$ = goog.getMsg("My i18n block #3");
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵi18nStart(1, $MSG_APP_SPEC_TS_0$);
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(2, "div");
$r3$.ɵtext(3, "My non-i18n block #1");
$r3$.ɵelementEnd();
$r3$.ɵelementStart(4, "div");
$r3$.ɵi18nStart(5, $MSG_APP_SPEC_TS_1$);
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(6, "div");
$r3$.ɵtext(7, "My non-i18n block #2");
$r3$.ɵelementEnd();
$r3$.ɵelementStart(8, "div");
$r3$.ɵi18nStart(9, $MSG_APP_SPEC_TS_2$);
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
it('should handle i18n attributes with bindings in content', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div i18n>My i18n block #{{ one }}</div>
<div i18n>My i18n block #{{ two | uppercase }}</div>
<div i18n>My i18n block #{{ three + four + five }}</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = String.raw `
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("My i18n block #\uFFFD0\uFFFD");
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("My i18n block #\uFFFD0\uFFFD");
const $MSG_APP_SPEC_TS_2$ = goog.getMsg("My i18n block #\uFFFD0\uFFFD");
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵi18nStart(1, $MSG_APP_SPEC_TS_0$);
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(2, "div");
$r3$.ɵi18nStart(3, $MSG_APP_SPEC_TS_1$);
$r3$.ɵpipe(4, "uppercase");
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(5, "div");
$r3$.ɵi18nStart(6, $MSG_APP_SPEC_TS_2$);
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
}
if (rf & 2) {
$r3$.ɵi18nExp($r3$.ɵbind(ctx.one));
$r3$.ɵi18nApply(1);
$r3$.ɵi18nExp($r3$.ɵbind($r3$.ɵpipeBind1(4, 0, ctx.two)));
$r3$.ɵi18nApply(3);
$r3$.ɵi18nExp($r3$.ɵbind(((ctx.three + ctx.four) + ctx.five)));
$r3$.ɵi18nApply(6);
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
it('should handle i18n attributes with bindings and nested elements in content', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div i18n>
My i18n block #{{ one }}
<span>Plain text in nested element</span>
</div>
<div i18n>
My i18n block #{{ two | uppercase }}
<div>
<div>
<span>
More bindings in more nested element: {{ nestedInBlockTwo }}
</span>
</div>
</div>
</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = String.raw `
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("My i18n block #\uFFFD0\uFFFD\uFFFD#2\uFFFDPlain text in nested element\uFFFD/#2\uFFFD");
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("My i18n block #\uFFFD0\uFFFD\uFFFD#6\uFFFD\uFFFD#7\uFFFD\uFFFD#8\uFFFDMore bindings in more nested element: \uFFFD1\uFFFD\uFFFD/#8\uFFFD\uFFFD/#7\uFFFD\uFFFD/#6\uFFFD");
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵi18nStart(1, $MSG_APP_SPEC_TS_0$);
$r3$.ɵelement(2, "span");
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(3, "div");
$r3$.ɵi18nStart(4, $MSG_APP_SPEC_TS_1$);
$r3$.ɵpipe(5, "uppercase");
$r3$.ɵelementStart(6, "div");
$r3$.ɵelementStart(7, "div");
$r3$.ɵelement(8, "span");
$r3$.ɵelementEnd();
$r3$.ɵelementEnd();
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
}
if (rf & 2) {
$r3$.ɵi18nExp($r3$.ɵbind(ctx.one));
$r3$.ɵi18nApply(1);
$r3$.ɵi18nExp($r3$.ɵbind($r3$.ɵpipeBind1(5, 0, ctx.two)));
$r3$.ɵi18nExp($r3$.ɵbind(ctx.nestedInBlockTwo));
$r3$.ɵi18nApply(4);
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
it('should handle i18n attributes with bindings in content and element attributes', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div i18n>
My i18n block #1 with value: {{ valueA }}
<span i18n-title title="Span title {{ valueB }} and {{ valueC }}">
Plain text in nested element (block #1)
</span>
</div>
<div i18n>
My i18n block #2 with value {{ valueD | uppercase }}
<span i18n-title title="Span title {{ valueE }}">
Plain text in nested element (block #2)
</span>
</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = String.raw `
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("My i18n block #1 with value: \uFFFD0\uFFFD\uFFFD#2\uFFFDPlain text in nested element (block #1)\uFFFD/#2\uFFFD");
const $MSG_APP_SPEC_TS_1$ = goog.getMsg("Span title \uFFFD0\uFFFD and \uFFFD1\uFFFD");
const $_c2$ = ["title", $MSG_APP_SPEC_TS_1$, 2];
const $MSG_APP_SPEC_TS_3$ = goog.getMsg("My i18n block #2 with value \uFFFD0\uFFFD\uFFFD#7\uFFFDPlain text in nested element (block #2)\uFFFD/#7\uFFFD");
const $MSG_APP_SPEC_TS_4$ = goog.getMsg("Span title \uFFFD0\uFFFD");
const $_c5$ = ["title", $MSG_APP_SPEC_TS_4$, 1];
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵi18nStart(1, $MSG_APP_SPEC_TS_0$);
$r3$.ɵelementStart(2, "span");
$r3$.ɵi18nAttribute(3, $_c2$);
$r3$.ɵelementEnd();
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementStart(4, "div");
$r3$.ɵi18nStart(5, $MSG_APP_SPEC_TS_3$);
$r3$.ɵpipe(6, "uppercase");
$r3$.ɵelementStart(7, "span");
$r3$.ɵi18nAttribute(8, $_c5$);
$r3$.ɵelementEnd();
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
}
if (rf & 2) {
$r3$.ɵi18nExp($r3$.ɵbind(ctx.valueB));
$r3$.ɵi18nExp($r3$.ɵbind(ctx.valueC));
$r3$.ɵi18nApply(3);
$r3$.ɵi18nExp($r3$.ɵbind(ctx.valueA));
$r3$.ɵi18nApply(1);
$r3$.ɵi18nExp($r3$.ɵbind(ctx.valueE));
$r3$.ɵi18nApply(8);
$r3$.ɵi18nExp($r3$.ɵbind($r3$.ɵpipeBind1(6, 0, ctx.valueD)));
$r3$.ɵi18nApply(5);
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
it('should handle i18n attributes in nested templates', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div>
Some content
<div *ngIf="visible">
<div i18n>
Some other content {{ valueA }}
<div>
More nested levels with bindings {{ valueB | uppercase }}
</div>
</div>
</div>
</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = String.raw `
const $_c0$ = [1, "ngIf"];
const $MSG_APP_SPEC_TS__1$ = goog.getMsg("Some other content \uFFFD0\uFFFD\uFFFD#3\uFFFDMore nested levels with bindings \uFFFD1\uFFFD\uFFFD/#3\uFFFD");
function MyComponent_div_Template_2(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵelementStart(1, "div");
$r3$.ɵi18nStart(2, $MSG_APP_SPEC_TS__1$);
$r3$.ɵelement(3, "div");
$r3$.ɵpipe(4, "uppercase");
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
$r3$.ɵelementEnd();
}
if (rf & 2) {
const $$ctx_r0$$ = $r3$.ɵnextContext();
$r3$.ɵi18nExp($r3$.ɵbind($$ctx_r0$$.valueA));
$r3$.ɵi18nExp($r3$.ɵbind($r3$.ɵpipeBind1(4, 0, $$ctx_r0$$.valueB)));
$r3$.ɵi18nApply(2);
}
}
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵtext(1, " Some content ");
$r3$.ɵtemplate(2, MyComponent_div_Template_2, 5, 2, null, $_c0$);
$r3$.ɵelementEnd();
}
if (rf & 2) {
$r3$.ɵelementProperty(2, "ngIf", $r3$.ɵbind(ctx.visible));
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');
});
it('should handle i18n context in nested templates', () => {
const files = {
app: {
'spec.ts': `
import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component',
template: \`
<div i18n>
Some content
<div *ngIf="visible">
Some other content {{ valueA }}
<div>
More nested levels with bindings {{ valueB | uppercase }}
<div *ngIf="exists">
Content inside sub-template {{ valueC }}
<div>
Bottom level element {{ valueD }}
</div>
</div>
</div>
</div>
<div *ngIf="!visible">
Some other content {{ valueE + valueF }}
<div>
More nested levels with bindings {{ valueG | uppercase }}
</div>
</div>
</div>
\`
})
export class MyComponent {}
@NgModule({declarations: [MyComponent]})
export class MyModule {}
`
}
};
const template = String.raw `
const $MSG_APP_SPEC_TS_0$ = goog.getMsg("Some content\uFFFD*2:1\uFFFD\uFFFD#1:1\uFFFDSome other content \uFFFD0:1\uFFFD\uFFFD#2:1\uFFFDMore nested levels with bindings \uFFFD1:1\uFFFD\uFFFD*4:2\uFFFD\uFFFD#1:2\uFFFDContent inside sub-template \uFFFD0:2\uFFFD\uFFFD#2:2\uFFFDBottom level element \uFFFD1:2\uFFFD\uFFFD/#2:2\uFFFD\uFFFD/#1:2\uFFFD\uFFFD/*4:2\uFFFD\uFFFD/#2:1\uFFFD\uFFFD/#1:1\uFFFD\uFFFD/*2:1\uFFFD\uFFFD*3:3\uFFFD\uFFFD#1:3\uFFFDSome other content \uFFFD0:3\uFFFD\uFFFD#2:3\uFFFDMore nested levels with bindings \uFFFD1:3\uFFFD\uFFFD/#2:3\uFFFD\uFFFD/#1:3\uFFFD\uFFFD/*3:3\uFFFD");
const $_c1$ = [1, "ngIf"];
function MyComponent_div_div_Template_4(rf, ctx) {
if (rf & 1) {
$r3$.ɵi18nStart(0, $MSG_APP_SPEC_TS_0$, 2);
$r3$.ɵelementStart(1, "div");
$r3$.ɵelement(2, "div");
$r3$.ɵelementEnd();
$r3$.ɵi18nEnd();
}
if (rf & 2) {
const $ctx_r2$ = $r3$.ɵnextContext(2);
$r3$.ɵi18nExp($r3$.ɵbind($ctx_r2$.valueC));
$r3$.ɵi18nExp($r3$.ɵbind($ctx_r2$.valueD));
$r3$.ɵi18nApply(0);
}
}
function MyComponent_div_Template_2(rf, ctx) {
if (rf & 1) {
$r3$.ɵi18nStart(0, $MSG_APP_SPEC_TS_0$, 1);
$r3$.ɵelementStart(1, "div");
$r3$.ɵelementStart(2, "div");
$r3$.ɵpipe(3, "uppercase");
$r3$.ɵtemplate(4, MyComponent_div_div_Template_4, 3, 0, null, $_c1$);
$r3$.ɵelementEnd();
$r3$.ɵelementEnd();
$r3$.ɵi18nEnd();
}
if (rf & 2) {
const $ctx_r0$ = $r3$.ɵnextContext();
$r3$.ɵelementProperty(4, "ngIf", $r3$.ɵbind($ctx_r0$.exists));
$r3$.ɵi18nExp($r3$.ɵbind($ctx_r0$.valueA));
$r3$.ɵi18nExp($r3$.ɵbind($r3$.ɵpipeBind1(3, 0, $ctx_r0$.valueB)));
$r3$.ɵi18nApply(0);
}
}
function MyComponent_div_Template_3(rf, ctx) {
if (rf & 1) {
$r3$.ɵi18nStart(0, $MSG_APP_SPEC_TS_0$, 3);
$r3$.ɵelementStart(1, "div");
$r3$.ɵelement(2, "div");
$r3$.ɵpipe(3, "uppercase");
$r3$.ɵelementEnd();
$r3$.ɵi18nEnd();
}
if (rf & 2) {
const $ctx_r1$ = $r3$.ɵnextContext();
$r3$.ɵi18nExp($r3$.ɵbind(($ctx_r1$.valueE + $ctx_r1$.valueF)));
$r3$.ɵi18nExp($r3$.ɵbind($r3$.ɵpipeBind1(3, 0, $ctx_r1$.valueG)));
$r3$.ɵi18nApply(0);
}
}
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵelementStart(0, "div");
$r3$.ɵi18nStart(1, $MSG_APP_SPEC_TS_0$);
$r3$.ɵtemplate(2, MyComponent_div_Template_2, 5, 3, null, $_c1$);
$r3$.ɵtemplate(3, MyComponent_div_Template_3, 4, 2, null, $_c1$);
$r3$.ɵi18nEnd();
$r3$.ɵelementEnd();
}
if (rf & 2) {
$r3$.ɵelementProperty(2, "ngIf", $r3$.ɵbind(ctx.visible));
$r3$.ɵelementProperty(3, "ngIf", $r3$.ɵbind(!ctx.visible));
}
}
`;
const result = compile(files, angularFiles);
expectEmit(result.source, template, 'Incorrect template');