Skip to content

Commit d42cbd6

Browse files
committed
test(tooltip): update tests with auto hide delay
1 parent e647bf8 commit d42cbd6

File tree

1 file changed

+5
-26
lines changed

1 file changed

+5
-26
lines changed

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

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { IgxTooltipTargetDirective } from './tooltip-target.directive';
1010

1111
const HIDDEN_TOOLTIP_CLASS = 'igx-tooltip--hidden';
1212
const TOOLTIP_CLASS = 'igx-tooltip';
13+
const HIDE_DELAY = 180;
1314

1415
describe('IgxTooltip', () => {
1516
configureTestSuite();
@@ -136,6 +137,7 @@ describe('IgxTooltip', () => {
136137
flush();
137138

138139
unhoverElement(button);
140+
tick(HIDE_DELAY);
139141
tick(400);
140142
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
141143

@@ -179,31 +181,6 @@ describe('IgxTooltip', () => {
179181
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
180182
}));
181183

182-
it('IgxTooltip closes and reopens if it was opened through API and then its target is hovered', fakeAsync(() => {
183-
tooltipTarget.showTooltip();
184-
flush();
185-
186-
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
187-
188-
hoverElement(button);
189-
190-
tick(100);
191-
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
192-
193-
tick(100);
194-
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
195-
}));
196-
197-
it('IgxTooltip closes and reopens if opening it through API multiple times', fakeAsync(() => {
198-
spyOn(tooltipTarget.target, 'forceClose').and.callThrough();
199-
200-
tooltipTarget.showTooltip();
201-
tick();
202-
203-
tooltipTarget.showTooltip();
204-
expect(tooltipTarget.target.forceClose).toHaveBeenCalledTimes(1);
205-
}));
206-
207184
it('IgxTooltip respects the passed overlaySettings', fakeAsync(() => {
208185
// Hover the button.
209186
hoverElement(button);
@@ -424,6 +401,7 @@ describe('IgxTooltip', () => {
424401

425402
const dummyDiv = fix.debugElement.query(By.css('.dummyDiv'));
426403
touchElement(dummyDiv);
404+
tick(HIDE_DELAY);
427405
tick(400);
428406
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
429407

@@ -565,7 +543,8 @@ describe('IgxTooltip', () => {
565543
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, true);
566544

567545
UIInteractions.simulateClickEvent(button.nativeElement);
568-
fix.detectChanges();
546+
tick(HIDE_DELAY);
547+
tick(300);
569548

570549
verifyTooltipVisibility(tooltipNativeElement, tooltipTarget, false);
571550

0 commit comments

Comments
 (0)