【发布时间】:2020-10-10 07:04:30
【问题描述】:
在我的 TS 文件下面
@ViewChild('creditName', { read: false, static: false }) public creditName: ElementRef<any>;
onChange() {enter code here
this.creditName.nativeElement.style.border = '1px 纯红色';
}
在我的 HTML 中
谁能指导我,如何编写上面的测试用例...
我在下面尝试过,但没有任何效果
- spyOnProperty(div.nativeElement, 'style:border', 'get').and.returnValue('1px solid red');
- component.creditName = fixture.debugElement.query(By.css('.for-testing'));
【问题讨论】: