refactor(compiler): Add test for ICU root message with element tags (#53557)

Add test for ICU root message with element tags

PR Close #53557
This commit is contained in:
Dylan Hunn
2023-12-12 11:17:55 -08:00
committed by Andrew Scott
parent 886aa7b2a9
commit 0112aa3b81
3 changed files with 87 additions and 0 deletions
@@ -231,6 +231,20 @@
]
}
]
},
{
"description": "should handle ICUs with element tags, as the root message",
"inputFiles": [
"icu_root.ts"
],
"expectations": [
{
"extraChecks": [
"verifyPlaceholdersIntegrity",
"verifyUniqueConsts"
]
}
]
}
]
}
@@ -0,0 +1,45 @@
consts: () => {
let i18n_0;
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
/**
* @desc someText1
*/
const MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_1 = goog.getMsg("{VAR_SELECT, select, WEBSITE {{START_TAG_STRONG}someText{CLOSE_TAG_STRONG}\n }}");
i18n_0 = MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_1;
} else {
…
} i18n_0 = i0.ɵɵi18nPostprocess(i18n_0, { "CLOSE_TAG_STRONG": "</strong>", "START_TAG_STRONG": "<strong>", "VAR_SELECT": "\uFFFD0\uFFFD" });
let i18n_2;
if (typeof ngI18nClosureMode !== "undefined" && ngI18nClosureMode) {
/**
* @suppress {msgDescriptions}
*/
const MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_3 = goog.getMsg("{VAR_SELECT, select, WEBSITE {{START_TAG_STRONG}someText{CLOSE_TAG_STRONG}\n }}");
i18n_2 = MSG_EXTERNAL_4505060179465988919$$ICU_WHITESPACE_TS_3;
} else {
…
}
i18n_2 = i0.ɵɵi18nPostprocess(i18n_2, { "CLOSE_TAG_STRONG": "</strong>", "START_TAG_STRONG": "<strong>", "VAR_SELECT": "\uFFFD0\uFFFD" });
return [i18n_0, i18n_2];
}
…
function MyComponent_Template(rf, ctx) {
if (rf & 1) {
i0.ɵɵelementStart(0, "span");
i0.ɵɵi18n(1, 0);
i0.ɵɵelementEnd();
i0.ɵɵelementStart(2, "span");
i0.ɵɵtext(3, " ");
i0.ɵɵi18n(4, 1);
i0.ɵɵtext(5, " ");
i0.ɵɵelementEnd();
} if (rf & 2) {
i0.ɵɵadvance(1);
i0.ɵɵi18nExp(ctx.someField);
i0.ɵɵi18nApply(1);
i0.ɵɵadvance(3);
i0.ɵɵi18nExp(ctx.someField);
i0.ɵɵi18nApply(4);
}
}
@@ -0,0 +1,28 @@
import {Component} from '@angular/core';
@Component({
selector: 'my-component',
standalone: true,
template: `
<span i18n="someText1">{
someField,
select,
WEBSITE {
<strong>someText</strong>
}
}</span>
<span>
{
someField,
select,
WEBSITE {
<strong>someText</strong>
}
}
</span>
`,
})
export class MyComponent {
someField!: any;
}