I have a scroll-animation component which i can add to some other components in order to display a scroll animation. The scroll animation will be shown when the parent component has scroll-bar.
export class ScrollIndicatorComponent implements OnInit, OnDestroy, AfterViewInit {
constructor(private elementRef: ElementRef) {
}
...
componentHasScrollbar(): boolean {
const parentElement = this.elementRef.nativeElement.parentElement;
return parentElement.offsetHeight < parentElement.scrollHeight;
}
How can i mock the this.elementRef.nativeElement.parentElement and its offsetHeight and scrollHeight values, so the method componentHasScrollbar() will return true in my unit test?