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

Commit

Permalink
fix(tooltip): Fix for issue #3167
Browse files Browse the repository at this point in the history
  • Loading branch information
Antoine Pairet authored and wesleycho committed Mar 15, 2015
1 parent aa0b639 commit 87a3607
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/tooltip/test/tooltip2.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,16 @@ describe('tooltip directive', function () {
expect(fragment).not.toHaveOpenTooltips();
});

});
it('should not show tooltips element is disabled (button) - issue #3167', function () {
var fragment = compileTooltip('<button tooltip="cancel!" ng-disabled="disabled" ng-click="disabled = true">Cancel</button>');

fragment.find('button').trigger( 'mouseenter' );
expect(fragment).toHaveOpenTooltips();

fragment.find('button').trigger( 'click' );
$timeout.flush();
// One needs to flush deferred functions before checking there is no tooltip.
expect(fragment).not.toHaveOpenTooltips();
});

});
6 changes: 6 additions & 0 deletions src/tooltip/tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,12 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
}
});

attrs.$observe( 'disabled', function ( val ) {
if (val && ttScope.isOpen ) {
hide();
}
});

attrs.$observe( prefix+'Title', function ( val ) {
ttScope.title = val;
});
Expand Down

0 comments on commit 87a3607

Please sign in to comment.