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

Commit

Permalink
fix(tooltip): respect animate attribute
Browse files Browse the repository at this point in the history
Previously, it was only possible to set animation to false with an empty
string and options.

Closes #1418
  • Loading branch information
chrisirhc authored and pkozlowski-opensource committed Dec 28, 2013
1 parent 81e014a commit 54e614a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/tooltip/test/tooltip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ describe('tooltip', function() {
expect( elmScope.tt_isOpen ).toBe( false );
}));

it('should not animate on animation set to false', inject(function() {
expect( elmScope.tt_animation ).toBe( false );
}));

it('should have default placement of "top"', inject(function() {
elm.trigger( 'mouseenter' );
expect( elmScope.tt_placement ).toBe( "top" );
Expand Down
7 changes: 3 additions & 4 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,6 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
scope.tt_placement = angular.isDefined( val ) ? val : options.placement;
});

attrs.$observe(prefix + 'Animation', function (val) {
scope.tt_animation = angular.isDefined(val) ? !!val : options.animation;
});

attrs.$observe( prefix+'PopupDelay', function ( val ) {
var delay = parseInt( val, 10 );
scope.tt_popupDelay = ! isNaN(delay) ? delay : options.popupDelay;
Expand Down Expand Up @@ -292,6 +288,9 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
hasRegisteredTriggers = true;
});

var animation = scope.$eval(attrs[prefix + 'Animation']);
scope.tt_animation = angular.isDefined(animation) ? !!animation : options.animation;

attrs.$observe( prefix+'AppendToBody', function ( val ) {
appendToBody = angular.isDefined( val ) ? $parse( val )( scope ) : appendToBody;
});
Expand Down

0 comments on commit 54e614a

Please sign in to comment.