Skip to content

Commit d35831a

Browse files
committed
add test for post-animation
1 parent e041442 commit d35831a

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
@@ -268,6 +268,7 @@ export class TooltipComponent {
268268
_afterVisibilityAnimation(e: AnimationTransitionEvent): void {
269269
if (e.toState === 'hidden' && !this.isVisible()) {
270270
this._onHide.next();
271+
271272
}
272273
}
273274

0 commit comments

Comments
 (0)