DEV Community

Discussion on: An Angular Testing Cheatsheet

Collapse
 
vinaymcscet profile image
vinay kumar

I need to help on writing testcase for this functions.
private element: any;
@Input() id: string;

constructor(private el: ElementRef) {
this.element = el.nativeElement;
}

ngOnInit(): void {
if (!this.id) {
return;
}
this.element.addEventListener("click", (el: any) => {
if (el.target.className === "tfb-modal-background") {
this.close();
}
});
}