fix(ivy): update i18n/i18nStart and i18nAttributes instruction order (#28163)

Prior to this change element's i18n attributes like "i18n-title" were processed after "i18n" ones that placed "i18n" and "i18nAttributes" instructions in wrong order, thus "i18nAttributes" failed to target its host element at runtime. This change updates processing order and puts "i18nAttributes" instructions in front of "i18n" ones to resolve the problem.

PR Close #28163
This commit is contained in:
Andrew Kushnir
2019-01-15 12:10:41 -08:00
parent c61ea1d5bd
commit 9a81f0d9a8
3 changed files with 17 additions and 16 deletions

View File

@ -117,19 +117,18 @@ onlyInIvy('Ivy i18n logic').describe('i18n', function() {
}
});
fixmeIvy('FW-904: i18n attributes placed on i18n root node don\'t work')
.it('should work correctly when placed on i18n root node', () => {
const title = 'Hello {{ name }}';
const content = 'Hello';
const template = `
it('should work correctly when placed on i18n root node', () => {
const title = 'Hello {{ name }}';
const content = 'Hello';
const template = `
<div i18n i18n-title="m|d" title="${title}">${content}</div>
`;
const fixture = getFixtureWithOverrides({template});
const fixture = getFixtureWithOverrides({template});
const element = fixture.nativeElement.firstChild;
expect(element.title).toBe('Bonjour John');
expect(element).toHaveText('Bonjour');
});
const element = fixture.nativeElement.firstChild;
expect(element.title).toBe('Bonjour John');
expect(element).toHaveText('Bonjour');
});
it('should add i18n attributes on self-closing tags', () => {
const title = 'Hello {{ name }}';