1
1
import {
2
- async , ComponentFixture , TestBed , tick , fakeAsync ,
2
+ async ,
3
+ ComponentFixture ,
4
+ TestBed ,
5
+ tick ,
6
+ fakeAsync ,
3
7
flushMicrotasks
4
8
} from '@angular/core/testing' ;
5
9
import { Component , DebugElement , AnimationTransitionEvent } from '@angular/core' ;
6
10
import { By } from '@angular/platform-browser' ;
7
- import { TooltipPosition , MdTooltip , TOOLTIP_HIDE_DELAY , MdTooltipModule } from './tooltip' ;
11
+ import { TooltipPosition , MdTooltip , MdTooltipModule } from './tooltip' ;
8
12
import { OverlayContainer } from '../core' ;
9
13
10
14
const initialTooltipMessage = 'initial tooltip message' ;
@@ -52,11 +56,12 @@ describe('MdTooltip', () => {
52
56
expect ( overlayContainerElement . textContent ) . toContain ( initialTooltipMessage ) ;
53
57
54
58
// After hide called, a timeout delay is created that will to hide the tooltip.
55
- tooltipDirective . hide ( ) ;
59
+ const tooltipDelay = 1000 ;
60
+ tooltipDirective . hide ( tooltipDelay ) ;
56
61
expect ( tooltipDirective . _isTooltipVisible ( ) ) . toBe ( true ) ;
57
62
58
63
// After the tooltip delay elapses, expect that the tooltip is not visible.
59
- tick ( TOOLTIP_HIDE_DELAY ) ;
64
+ tick ( tooltipDelay ) ;
60
65
fixture . detectChanges ( ) ;
61
66
expect ( tooltipDirective . _isTooltipVisible ( ) ) . toBe ( false ) ;
62
67
@@ -70,12 +75,13 @@ describe('MdTooltip', () => {
70
75
expect ( tooltipDirective . _isTooltipVisible ( ) ) . toBe ( true ) ;
71
76
72
77
// After hide called, a timeout delay is created that will to hide the tooltip.
73
- tooltipDirective . hide ( ) ;
78
+ const tooltipDelay = 1000 ;
79
+ tooltipDirective . hide ( tooltipDelay ) ;
74
80
expect ( tooltipDirective . _isTooltipVisible ( ) ) . toBe ( true ) ;
75
81
76
82
// Before delay time has passed, call show which should cancel intent to hide tooltip.
77
83
tooltipDirective . show ( ) ;
78
- tick ( TOOLTIP_HIDE_DELAY ) ;
84
+ tick ( tooltipDelay ) ;
79
85
expect ( tooltipDirective . _isTooltipVisible ( ) ) . toBe ( true ) ;
80
86
} ) ) ;
81
87
0 commit comments