fix(ivy): support ICU messages inside <ng-container> (#27925)
PR Close #27925
This commit is contained in:

committed by
Kara Erickson

parent
d80c32310a
commit
8a3cebde8b
@ -15,7 +15,7 @@ import {getNativeByIndex} from '../../src/render3/util';
|
||||
|
||||
import {NgIf} from './common_with_def';
|
||||
|
||||
import {element, elementEnd, elementStart, template, text, nextContext, bind, elementProperty, projectionDef, projection} from '../../src/render3/instructions';
|
||||
import {element, elementEnd, elementStart, template, text, nextContext, bind, elementProperty, projectionDef, projection, elementContainerStart, elementContainerEnd} from '../../src/render3/instructions';
|
||||
import {COMMENT_MARKER, ELEMENT_MARKER, I18nMutateOpCode, I18nUpdateOpCode, I18nUpdateOpCodes, TI18n} from '../../src/render3/interfaces/i18n';
|
||||
import {HEADER_OFFSET, LView, TVIEW} from '../../src/render3/interfaces/view';
|
||||
import {ComponentFixture, TemplateFixture} from './render_util';
|
||||
@ -713,6 +713,28 @@ describe('Runtime i18n', () => {
|
||||
expect(fixture.html)
|
||||
.toEqual(
|
||||
'<div><span>3 <span title="emails label">emails</span><!--ICU 4--></span></div>');
|
||||
});
|
||||
|
||||
it('for ICU expressions inside <ng-container>', () => {
|
||||
const MSG_DIV = `{<7B>0<EFBFBD>, plural,
|
||||
=0 {no <b title="none">emails</b>!}
|
||||
=1 {one <i>email</i>}
|
||||
other {<7B>0<EFBFBD> <span title="<22>1<EFBFBD>">emails</span>}
|
||||
}`;
|
||||
const fixture = prepareFixture(() => {
|
||||
elementStart(0, 'div'); {
|
||||
elementContainerStart(1); {
|
||||
i18n(2, MSG_DIV);
|
||||
}
|
||||
elementContainerEnd();
|
||||
}
|
||||
elementEnd();
|
||||
}, () => {
|
||||
i18nExp(bind(0));
|
||||
i18nApply(2);
|
||||
}, 3, 1);
|
||||
|
||||
expect(fixture.html).toEqual('<div>no <b title="none">emails</b>!<!--ICU 4--></div>');
|
||||
});
|
||||
|
||||
it('for nested ICU expressions', () => {
|
||||
|
Reference in New Issue
Block a user