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

Commit 34044a7

Browse files
chrisirhcrvanbaalen
authored and
rvanbaalen
committed
fix(tooltip): tooltip-html should not open if empty
Closes #3563
1 parent 422c823 commit 34044a7

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/tooltip/test/tooltip.spec.js

+7
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,13 @@ describe( 'tooltipHtml', function() {
528528
expect( elmBody.find('.tooltip-inner').html() ).toBe( scope.html );
529529
}));
530530

531+
it( 'should not open if html is empty', function () {
532+
scope.safeHtml = null;
533+
scope.$digest();
534+
elm.trigger( 'mouseenter' );
535+
expect( tooltipScope.isOpen ).toBe( false );
536+
});
537+
531538
it( 'should show on mouseenter and hide on mouseleave', inject( function ($sce) {
532539
expect( tooltipScope.isOpen ).toBe( false );
533540

src/tooltip/tooltip.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,9 @@ function ($animate , $sce , $compile , $templateRequest) {
500500
})
501501

502502
.directive( 'tooltipHtml', [ '$tooltip', function ( $tooltip ) {
503-
return $tooltip( 'tooltipHtml', 'tooltip', 'mouseenter' );
503+
return $tooltip('tooltipHtml', 'tooltip', 'mouseenter', {
504+
useContentExp: true
505+
});
504506
}])
505507

506508
/*

0 commit comments

Comments
 (0)