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

Commit 87a3607

Browse files
Antoine Pairetwesleycho
Antoine Pairet
authored andcommitted
fix(tooltip): Fix for issue #3167
1 parent aa0b639 commit 87a3607

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/tooltip/test/tooltip2.spec.js

+13-1
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,16 @@ describe('tooltip directive', function () {
133133
expect(fragment).not.toHaveOpenTooltips();
134134
});
135135

136-
});
136+
it('should not show tooltips element is disabled (button) - issue #3167', function () {
137+
var fragment = compileTooltip('<button tooltip="cancel!" ng-disabled="disabled" ng-click="disabled = true">Cancel</button>');
138+
139+
fragment.find('button').trigger( 'mouseenter' );
140+
expect(fragment).toHaveOpenTooltips();
141+
142+
fragment.find('button').trigger( 'click' );
143+
$timeout.flush();
144+
// One needs to flush deferred functions before checking there is no tooltip.
145+
expect(fragment).not.toHaveOpenTooltips();
146+
});
147+
148+
});

src/tooltip/tooltip.js

+6
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,12 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position', 'ui.bootstrap
266266
}
267267
});
268268

269+
attrs.$observe( 'disabled', function ( val ) {
270+
if (val && ttScope.isOpen ) {
271+
hide();
272+
}
273+
});
274+
269275
attrs.$observe( prefix+'Title', function ( val ) {
270276
ttScope.title = val;
271277
});

0 commit comments

Comments
 (0)