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

Commit 54e614a

Browse files
chrisirhcpkozlowski-opensource
authored andcommitted
fix(tooltip): respect animate attribute
Previously, it was only possible to set animation to false with an empty string and options. Closes #1418
1 parent 81e014a commit 54e614a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/tooltip/test/tooltip.spec.js

+4
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ describe('tooltip', function() {
4545
expect( elmScope.tt_isOpen ).toBe( false );
4646
}));
4747

48+
it('should not animate on animation set to false', inject(function() {
49+
expect( elmScope.tt_animation ).toBe( false );
50+
}));
51+
4852
it('should have default placement of "top"', inject(function() {
4953
elm.trigger( 'mouseenter' );
5054
expect( elmScope.tt_placement ).toBe( "top" );

src/tooltip/tooltip.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -261,10 +261,6 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
261261
scope.tt_placement = angular.isDefined( val ) ? val : options.placement;
262262
});
263263

264-
attrs.$observe(prefix + 'Animation', function (val) {
265-
scope.tt_animation = angular.isDefined(val) ? !!val : options.animation;
266-
});
267-
268264
attrs.$observe( prefix+'PopupDelay', function ( val ) {
269265
var delay = parseInt( val, 10 );
270266
scope.tt_popupDelay = ! isNaN(delay) ? delay : options.popupDelay;
@@ -292,6 +288,9 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
292288
hasRegisteredTriggers = true;
293289
});
294290

291+
var animation = scope.$eval(attrs[prefix + 'Animation']);
292+
scope.tt_animation = angular.isDefined(animation) ? !!animation : options.animation;
293+
295294
attrs.$observe( prefix+'AppendToBody', function ( val ) {
296295
appendToBody = angular.isDefined( val ) ? $parse( val )( scope ) : appendToBody;
297296
});

0 commit comments

Comments
 (0)