Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

fix(tooltip): Remove the $locationChangeSuccess close behaviour #5360

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/tooltip/test/tooltip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -998,25 +998,6 @@ describe('$uibTooltipProvider', function() {
expect($body.children().length).toEqual(bodyLength);
}));

it('should close on location change', inject(function($rootScope, $compile) {
elmBody = angular.element(
'<div><span uib-tooltip="tooltip text">Selector Text</span></div>'
);

scope = $rootScope;
$compile(elmBody)(scope);
scope.$digest();
elm = elmBody.find('span');
elmScope = elm.scope();
tooltipScope = elmScope.$$childTail;

trigger(elm, 'mouseenter');
expect(tooltipScope.isOpen).toBe(true);

scope.$broadcast('$locationChangeSuccess');
scope.$digest();
expect(tooltipScope.isOpen).toBe(false);
}));
});

describe('triggers', function() {
Expand Down
13 changes: 1 addition & 12 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -540,18 +540,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
}

appendToBody = angular.isDefined(appendToBodyVal) ? appendToBodyVal : appendToBody;

// if a tooltip is attached to <body> we need to remove it on
// location change as its parent scope will probably not be destroyed
// by the change.
if (appendToBody) {
scope.$on('$locationChangeSuccess', function closeTooltipOnLocationChangeSuccess() {
if (ttScope.isOpen) {
hide();
}
});
}


// Make sure tooltip is destroyed and removed.
scope.$on('$destroy', function onDestroyTooltip() {
unregisterTriggers();
Expand Down