Skip to content

Commit 200e46b

Browse files
committed
test(tooltip): update touch tests
1 parent 46aefa7 commit 200e46b

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

projects/igniteui-angular/src/lib/directives/tooltip/tooltip.directive.spec.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ describe('IgxTooltip', () => {
9797

9898
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
9999

100-
const arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom');
100+
const arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom') as HTMLElement;
101101
expect(arrow).not.toBeNull();
102102
expect(arrow.style.display).toEqual("none");
103103
}));
@@ -115,7 +115,7 @@ describe('IgxTooltip', () => {
115115
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
116116

117117
expect(tooltipTarget.hasArrow).toBeTrue();
118-
const arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom');
118+
const arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom') as HTMLElement;
119119
expect(arrow.style.display).toEqual("");
120120

121121
tooltipTarget.hasArrow = false;
@@ -573,8 +573,8 @@ describe('IgxTooltip', () => {
573573
}));
574574

575575
it('Should not call `hideTooltip` multiple times on document:touchstart', fakeAsync(() => {
576-
spyOn(targetOne, 'hideTooltip').and.callThrough();
577-
spyOn(targetTwo, 'hideTooltip').and.callThrough();
576+
spyOn<any>(targetOne, '_hideOnInteraction').and.callThrough();
577+
spyOn<any>(targetTwo, '_hideOnInteraction').and.callThrough();
578578

579579
touchElement(buttonOne);
580580
tick(500);
@@ -583,8 +583,8 @@ describe('IgxTooltip', () => {
583583
touchElement(dummyDiv);
584584
flush();
585585

586-
expect(targetOne.hideTooltip).toHaveBeenCalledTimes(1);
587-
expect(targetTwo.hideTooltip).not.toHaveBeenCalled();
586+
expect(targetOne['_hideOnInteraction']).toHaveBeenCalledTimes(1);
587+
expect(targetTwo['_hideOnInteraction']).not.toHaveBeenCalled();
588588
}));
589589

590590
it('should not emit tooltipHide event multiple times', fakeAsync(() => {
@@ -793,16 +793,18 @@ describe('IgxTooltip', () => {
793793
flush();
794794

795795
verifyTooltipVisibility(tooltipNativeElement, targetOne, true);
796-
expect(tooltipNativeElement.querySelector('.igx-tooltip--bottom').style.display).toEqual('');
796+
let arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom') as HTMLElement;
797+
expect(arrow.style.display).toEqual('');
797798

798799
unhoverElement(buttonOne);
799800
flush();
800801

801802
hoverElement(buttonTwo);
802803
flush();
803804

805+
arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom') as HTMLElement;
804806
verifyTooltipVisibility(tooltipNativeElement, targetTwo, true);
805-
expect(tooltipNativeElement.querySelector('.igx-tooltip--bottom').style.display).toEqual('none');
807+
expect(arrow.style.display).toEqual('none');
806808
}));
807809
});
808810

@@ -1009,7 +1011,7 @@ describe('IgxTooltip', () => {
10091011
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
10101012
verifyTooltipPosition(tooltipNativeElement, button, true, tooltipTarget.placement);
10111013

1012-
const arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom');
1014+
const arrow = tooltipNativeElement.querySelector('.igx-tooltip--bottom') as HTMLElement;
10131015
expect(arrow).not.toBeNull();
10141016
expect(arrow.style.left).toBe("");
10151017
}));

0 commit comments

Comments
 (0)