feat(ivy): support host properties in DebugElement.properties (#28355)
DebugElement.properties should contain a map of element property names to element property values, with entries for both normal property bindings and host bindings. Many Angular core tests depend on this map being present. This commit adds support for host property bindings in DebugElement.properties, which fixes the Angular core tests. There is still work to be done for normal property bindings. PR Close #28355
This commit is contained in:

committed by
Jason Aden

parent
c522e03fe9
commit
46aec4a58f
@ -924,26 +924,24 @@ function declareTests(config?: {useJit: boolean}) {
|
||||
expect(getDOM().getProperty(tc.nativeElement, 'id')).toEqual('newId');
|
||||
});
|
||||
|
||||
fixmeIvy('FW-681: not possible to retrieve host property bindings from TView')
|
||||
.it('should not use template variables for expressions in hostProperties', () => {
|
||||
@Directive(
|
||||
{selector: '[host-properties]', host: {'[id]': 'id', '[title]': 'unknownProp'}})
|
||||
class DirectiveWithHostProps {
|
||||
id = 'one';
|
||||
}
|
||||
it('should not use template variables for expressions in hostProperties', () => {
|
||||
@Directive({selector: '[host-properties]', host: {'[id]': 'id', '[title]': 'unknownProp'}})
|
||||
class DirectiveWithHostProps {
|
||||
id = 'one';
|
||||
}
|
||||
|
||||
const fixture =
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveWithHostProps]})
|
||||
.overrideComponent(MyComp, {
|
||||
set: {template: `<div *ngFor="let id of ['forId']" host-properties></div>`}
|
||||
})
|
||||
.createComponent(MyComp);
|
||||
fixture.detectChanges();
|
||||
const fixture =
|
||||
TestBed.configureTestingModule({declarations: [MyComp, DirectiveWithHostProps]})
|
||||
.overrideComponent(
|
||||
MyComp,
|
||||
{set: {template: `<div *ngFor="let id of ['forId']" host-properties></div>`}})
|
||||
.createComponent(MyComp);
|
||||
fixture.detectChanges();
|
||||
|
||||
const tc = fixture.debugElement.children[0];
|
||||
expect(tc.properties['id']).toBe('one');
|
||||
expect(tc.properties['title']).toBe(undefined);
|
||||
});
|
||||
const tc = fixture.debugElement.children[0];
|
||||
expect(tc.properties['id']).toBe('one');
|
||||
expect(tc.properties['title']).toBe(undefined);
|
||||
});
|
||||
|
||||
fixmeIvy('FW-725: Pipes in host bindings fail with a cryptic error')
|
||||
.it('should not allow pipes in hostProperties', () => {
|
||||
|
Reference in New Issue
Block a user