fix(ivy): correctly project bare ICU expressions (#30696)
Projecting bare ICU expressions failed because we would assume that component's content nodes would be projected later and doing so at that point would be wasteful. But ICU nodes are handled independently and should be inserted immediately because they will be ignored by projections. FW-1348 #resolve PR Close #30696
This commit is contained in:

committed by
Misko Hevery

parent
21328f2373
commit
680d38513b
@ -591,6 +591,33 @@ onlyInIvy('Ivy i18n logic').describe('runtime i18n', () => {
|
||||
fixture.detectChanges();
|
||||
expect(fixture.nativeElement.innerHTML).toEqual('no email<!--ICU 2-->');
|
||||
});
|
||||
|
||||
it('projection', () => {
|
||||
@Component({selector: 'child', template: '<div><ng-content></ng-content></div>'})
|
||||
class Child {
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'parent',
|
||||
template: `
|
||||
<child i18n>{
|
||||
value // i18n(ph = "blah"),
|
||||
plural,
|
||||
=1 {one}
|
||||
other {at least {{value}} .}
|
||||
}</child>`
|
||||
})
|
||||
class Parent {
|
||||
value = 3;
|
||||
}
|
||||
TestBed.configureTestingModule({declarations: [Parent, Child]});
|
||||
ɵi18nConfigureLocalize({translations: {}});
|
||||
|
||||
const fixture = TestBed.createComponent(Parent);
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(fixture.nativeElement.innerHTML).toContain('at least');
|
||||
});
|
||||
});
|
||||
|
||||
describe('should support attributes', () => {
|
||||
|
Reference in New Issue
Block a user