Я пытаюсь инициализировать свойство прокрутки в одном из моих тестов Жасмин и получить ошибку Недопустимый конструктор. Что не так в том, как я инициализирую компонент прокрутки. Я инициализировал его следующим образом:
component.scroll = new ElementRef ({HTMLDivElement: new HTMLDivElement ()});
Тест
fit('should call checkIfLastAgreement and notify that its not the last agreement when accept is called', () => {
component.agreementLength = 2;
component.lastAgreement = false;
component.activeBtn = 0;
component.currentIndex = 0;
component.scroll = new ElementRef({ HTMLDivElement: new HTMLDivElement()} );
component.myData = [{userAgreementId: 1}, { acceptanceWindowExpiry: acceptanceDateUtc }, {timeLeft: '2d'}];
, {timeLeft: '2d'}];
fixture.detectChanges();
component.accept();
expect(component.agreementsService.updateAgreement).toHaveBeenCalled();
expect(component.lastAgreement).toBe(false);
expect(component.endOfAgreements).toBe(false);
});
Компонент
@ViewChild('scroll', { read: ElementRef, static: false })
public scroll: ElementRef<any>;