diff --git a/src/tooltip/test/tooltip2.spec.js b/src/tooltip/test/tooltip2.spec.js index 7162d23208..c161ba01ac 100644 --- a/src/tooltip/test/tooltip2.spec.js +++ b/src/tooltip/test/tooltip2.spec.js @@ -133,4 +133,16 @@ describe('tooltip directive', function () { expect(fragment).not.toHaveOpenTooltips(); }); -}); \ No newline at end of file + it('should not show tooltips element is disabled (button) - issue #3167', function () { + var fragment = compileTooltip(''); + + 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(); + }); + +}); diff --git a/src/tooltip/tooltip.js b/src/tooltip/tooltip.js index 4659e8bdc7..70932db2b0 100644 --- a/src/tooltip/tooltip.js +++ b/src/tooltip/tooltip.js @@ -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; });