Skip to content

Commit 1cad6f8

Browse files
committed
add test for post-animation
1 parent 9de1eb1 commit 1cad6f8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/lib/tooltip/tooltip.spec.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ describe('MdTooltip', () => {
5454

5555
// After the tooltip delay elapses, expect that the tooltip is not visible.
5656
tick(TOOLTIP_HIDE_DELAY);
57+
fixture.detectChanges();
5758
expect(tooltipDirective._isTooltipVisible()).toBe(false);
59+
60+
// On animation complete, should expect that the tooltip has been detached.
61+
fixture.whenStable().then(() => {
62+
expect(tooltipDirective._tooltipInstance).toBeNull();
63+
});
5864
}));
5965

60-
it('should not follow through with hide if show is called after', fakeAsync(() => {
66+
it('should not follow through with hide if show is called after', fakeAsync(() => {
6167
tooltipDirective.show();
6268
expect(tooltipDirective._isTooltipVisible()).toBe(true);
6369

src/lib/tooltip/tooltip.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ export class TooltipComponent {
262262
_afterVisibilityAnimation(e: AnimationTransitionEvent): void {
263263
if (e.toState === 'hidden' && !this.isVisible()) {
264264
this._onHide.next();
265+
265266
}
266267
}
267268

0 commit comments

Comments
 (0)