I need help to fix unit test cases in angular
I have function to set focus on button element and this function is called in ngOnInit below is the code
public buttonElement: ElementRef,
private changeDector: ChangeDetectorRef,
above two line of code in constructor
setTimeout(() => {
if (this.buttonElement.nativeElement.querySelectorAll('button')[0]) {
this.buttonElement.nativeElement.querySelectorAll('button')[0].focus();
}
}, 500);
this.changeDector.detectChanges();
I need to cover this function in unit test case .
question from:
https://stackoverflow.com/questions/65919798/unit-test-case-for-nativeelement-focus 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…