Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 48c9cd8

Browse files
Matthew McLeodwesleycho
Matthew McLeod
authored andcommittedJan 28, 2016
fix(tooltip): prevent closing on $locationChangeSuccess
- Remove incorrect logic for closing tooltip/popover on $locationChangeSuccess Closes #5360 Fixes #5337
1 parent 0b7e742 commit 48c9cd8

File tree

2 files changed

+1
-31
lines changed

2 files changed

+1
-31
lines changed
 

Diff for: ‎src/tooltip/test/tooltip.spec.js

-19
Original file line numberDiff line numberDiff line change
@@ -998,25 +998,6 @@ describe('$uibTooltipProvider', function() {
998998
expect($body.children().length).toEqual(bodyLength);
999999
}));
10001000

1001-
it('should close on location change', inject(function($rootScope, $compile) {
1002-
elmBody = angular.element(
1003-
'<div><span uib-tooltip="tooltip text">Selector Text</span></div>'
1004-
);
1005-
1006-
scope = $rootScope;
1007-
$compile(elmBody)(scope);
1008-
scope.$digest();
1009-
elm = elmBody.find('span');
1010-
elmScope = elm.scope();
1011-
tooltipScope = elmScope.$$childTail;
1012-
1013-
trigger(elm, 'mouseenter');
1014-
expect(tooltipScope.isOpen).toBe(true);
1015-
1016-
scope.$broadcast('$locationChangeSuccess');
1017-
scope.$digest();
1018-
expect(tooltipScope.isOpen).toBe(false);
1019-
}));
10201001
});
10211002

10221003
describe('triggers', function() {

Diff for: ‎src/tooltip/tooltip.js

+1-12
Original file line numberDiff line numberDiff line change
@@ -540,18 +540,7 @@ angular.module('ui.bootstrap.tooltip', ['ui.bootstrap.position', 'ui.bootstrap.s
540540
}
541541

542542
appendToBody = angular.isDefined(appendToBodyVal) ? appendToBodyVal : appendToBody;
543-
544-
// if a tooltip is attached to <body> we need to remove it on
545-
// location change as its parent scope will probably not be destroyed
546-
// by the change.
547-
if (appendToBody) {
548-
scope.$on('$locationChangeSuccess', function closeTooltipOnLocationChangeSuccess() {
549-
if (ttScope.isOpen) {
550-
hide();
551-
}
552-
});
553-
}
554-
543+
555544
// Make sure tooltip is destroyed and removed.
556545
scope.$on('$destroy', function onDestroyTooltip() {
557546
unregisterTriggers();

0 commit comments

Comments
 (0)
This repository has been archived.