Skip to content

chore(tooltip): unit test failures #8385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2017

Conversation

crisbeto
Copy link
Member

  • Fixes a regression in the tooltip that was introduced by 0719c38 which caused the tests to fail.
  • Avoids issues in the future where failures in some tooltip tests can cause Jasmine to throw the browser into an infinite loop by trying to stringify a circular object.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 12, 2017
@@ -261,7 +262,7 @@ export class MatTooltip implements OnDestroy {
this._tooltipInstance = overlayRef.attach(portal).instance;

// Dispose of the tooltip when the overlay is detached.
overlayRef.detachments().subscribe(() => {
merge(this._tooltipInstance!.afterHidden(), overlayRef.detachments()).subscribe(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the ! up to the assignment for tooltipInstance?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS isn't smart enough to figure it out when it's being assigned to a property, it only works for variables.

@@ -80,7 +80,7 @@ describe('MatTooltip', () => {
});

it('should show and hide the tooltip', fakeAsync(() => {
expect(tooltipDirective._tooltipInstance).toBeUndefined();
expect(!!tooltipDirective._tooltipInstance).toBe(false);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it just one place that does this? Something like a method getTooltipInstance? That way it's easy to add a comment in one place that explains it rather than repeating !! without explanation

* Fixes a regression in the tooltip that was introduced by 0719c38 which caused the tests to fail.
* Avoids issues in the future where failures in some tooltip tests can cause Jasmine to throw the browser into an infinite loop by trying to stringify a circular object.
@crisbeto crisbeto force-pushed the tooltip-detach-regression branch from 95b4ea3 to 223c49b Compare November 14, 2017 16:23
@crisbeto
Copy link
Member Author

Addressed the feedback @jelbourn.

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Nov 14, 2017
@jelbourn jelbourn merged commit b959014 into angular:master Nov 14, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants