test(ivy): add test for class setters being invoked when not used (#34706)

Adds a test that we should make pass once the latest styling refactor has landed.

PR Close #34706
This commit is contained in:
crisbeto 2020-01-09 20:12:44 +01:00 committed by atscott
parent 99cc7cdc15
commit e48e36bde3
1 changed files with 24 additions and 0 deletions

View File

@ -2507,6 +2507,30 @@ describe('styling', () => {
expect(trailing.className).toBe('foo', 'Expected class to be applied despite trailing space.');
});
// TODO(FW-1360): re-enable this test once the new styling changes are in place.
xit('should not set inputs called class if they are not being used in the template', () => {
const logs: string[] = [];
@Directive({selector: '[test]'})
class MyDir {
@Input('class')
set className(value: string) { logs.push(value); }
}
@Component({
// Note that we shouldn't have a `class` attribute here.
template: `<div test></div>`
})
class MyComp {
}
TestBed.configureTestingModule({declarations: [MyComp, MyDir]});
const fixture = TestBed.createComponent(MyComp);
fixture.detectChanges();
expect(logs).toEqual([]);
});
});
function assertStyleCounters(countForSet: number, countForRemove: number) {