fix(ivy): handle pipes in i18n attributes properly (#30573)

Prior to this change we processed binding expression (including bindings with pipes) in i18n attributes before we generate update instruction. As a result, slot offsets for pipeBind instructions were calculated incorrectly. Now we perform binding expression processing when we generate "update block" instructions, so offsets are calculated correctly.

PR Close #30573
This commit is contained in:
Andrew Kushnir
2019-05-20 14:40:44 -07:00
committed by Jason Aden
parent 70fd4300f4
commit 02523debe5
3 changed files with 16 additions and 7 deletions

View File

@ -570,6 +570,14 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
expect(fixture.nativeElement.innerHTML).toEqual(`<div title="bonjour John"></div>`);
});
it('with pipes', () => {
ɵi18nConfigureLocalize(
{translations: {'hello {$interpolation}': 'bonjour {$interpolation}'}});
const fixture = initWithTemplate(
AppComp, `<div i18n i18n-title title="hello {{name | uppercase}}"></div>`);
expect(fixture.nativeElement.innerHTML).toEqual(`<div title="bonjour ANGULAR"></div>`);
});
it('multiple attributes', () => {
ɵi18nConfigureLocalize(
{translations: {'hello {$interpolation}': 'bonjour {$interpolation}'}});