fix(ivy): keep i18n-annotated attributes in element attribute list (#29856)
Prior to this change, element attributes annotated with i18n- prefix were removed from element attribute list and processed separately by i18n-specific logic. This behavior is causing issues with directive matching, since attributes are not present in the list of attrs for matching purposes. This commit updates i18n logic to retain attributes in the main attribute list, thus allowing directive matching logic to work correctly. PR Close #29856
This commit is contained in:

committed by
Alex Rickabaugh

parent
0aa0f11a2b
commit
6c018001d3
@ -18,6 +18,10 @@ describe('directives', () => {
|
||||
class TestDirective {
|
||||
}
|
||||
|
||||
@Directive({selector: '[title]'})
|
||||
class TitleDirective {
|
||||
}
|
||||
|
||||
@Component({selector: 'test-cmpt', template: ''})
|
||||
class TestComponent {
|
||||
}
|
||||
@ -42,6 +46,18 @@ describe('directives', () => {
|
||||
expect(nodesWithDirective.length).toBe(1);
|
||||
});
|
||||
|
||||
it('should match directives on i18n-annotated attributes', () => {
|
||||
TestBed.configureTestingModule({declarations: [TestComponent, TitleDirective]});
|
||||
TestBed.overrideTemplate(TestComponent, `
|
||||
<div title="My title" i18n-title="Title translation description"></div>
|
||||
`);
|
||||
|
||||
const fixture = TestBed.createComponent(TestComponent);
|
||||
const nodesWithDirective = fixture.debugElement.queryAllNodes(By.directive(TitleDirective));
|
||||
|
||||
expect(nodesWithDirective.length).toBe(1);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
Reference in New Issue
Block a user