test(ivy): verify no translations are generated for bound attributes (#31481)

This commit adds a test that verifies no translations are generated for bound attributes and also checks (as a part of the `verify` function) that VE and Ivy handle this case the same way.

PR Close #31481
This commit is contained in:
Andrew Kushnir 2019-07-09 18:08:33 -07:00 committed by Matias Niemelä
parent 524180c271
commit 76e3b57a12
1 changed files with 25 additions and 0 deletions

View File

@ -324,6 +324,31 @@ describe('i18n support in the view compiler', () => {
verify(input, output);
});
it('should not create translations for bound attributes', () => {
const input = `
<div
[title]="title" i18n-title
[attr.label]="label" i18n-attr.label>
</div>
`;
const output = `
const $_c0$ = [${AttributeMarker.Bindings}, "title", "label"];
template: function MyComponent_Template(rf, ctx) {
if (rf & 1) {
$r3$.ɵɵelement(0, "div", $_c0$);
}
if (rf & 2) {
$r3$.ɵɵproperty("title", ctx.title);
$r3$.ɵɵattribute("label", ctx.label);
}
}
`;
verify(input, output);
});
it('should translate static attributes', () => {
const input = `
<div id="static" i18n-title="m|d" title="introduction"></div>