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

Commit 030901e

Browse files
fix(tooltip): don't show tooltips if there is no content to show
Closes #129
1 parent 7575b3c commit 030901e

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/tooltip/test/tooltipSpec.js src/tooltip/test/tooltip.spec.js

+10
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ describe('tooltip', function() {
111111
elm.trigger( 'mouseleave' );
112112
}));
113113

114+
it('should not show tooltips if there is nothing to show - issue #129', inject(function ($compile) {
115+
116+
elmBody = $compile(angular.element(
117+
'<div><span tooltip="">Selector Text</span></div>'
118+
))(scope);
119+
scope.$digest();
120+
elmBody.find('span').trigger('mouseenter');
121+
122+
expect(elmBody.children().length).toBe(1);
123+
}));
114124
});
115125

116126

src/tooltip/tooltip.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ angular.module( 'ui.bootstrap.tooltip', [] )
6161
ttWidth,
6262
ttHeight,
6363
ttPosition;
64-
64+
65+
//don't show empty tooltips
66+
if (!scope.tt_tooltip) {
67+
return;
68+
}
69+
6570
// If there is a pending remove transition, we must cancel it, lest the
6671
// toolip be mysteriously removed.
6772
if ( transitionTimeout ) {

0 commit comments

Comments
 (0)