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:
parent
524180c271
commit
76e3b57a12
|
@ -324,6 +324,31 @@ describe('i18n support in the view compiler', () => {
|
||||||
verify(input, output);
|
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', () => {
|
it('should translate static attributes', () => {
|
||||||
const input = `
|
const input = `
|
||||||
<div id="static" i18n-title="m|d" title="introduction"></div>
|
<div id="static" i18n-title="m|d" title="introduction"></div>
|
||||||
|
|
Loading…
Reference in New Issue