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

Commit 56f624a

Browse files
fix(popover): don't unbind event handlers created by other directives
Closes #456
1 parent 8dc92af commit 56f624a

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

src/popover/test/popoverSpec.js

+22
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,28 @@ describe('popover', function() {
4444
elm.trigger( 'click' );
4545
expect( elmScope.tt_isOpen ).toBe( false );
4646
}));
47+
48+
it('should not unbind event handlers created by other directives - issue 456', inject( function( $compile ) {
49+
50+
scope.click = function() {
51+
scope.clicked = !scope.clicked;
52+
};
53+
54+
elmBody = angular.element(
55+
'<div><input popover="Hello!" ng-click="click()" popover-trigger="mouseenter"/></div>'
56+
);
57+
$compile(elmBody)(scope);
58+
scope.$digest();
59+
60+
elm = elmBody.find('input');
61+
62+
elm.trigger( 'mouseenter' );
63+
elm.trigger( 'mouseleave' );
64+
expect(scope.clicked).toBeFalsy();
65+
66+
elm.click();
67+
expect(scope.clicked).toBeTruthy();
68+
}));
4769
});
4870

4971

src/tooltip/tooltip.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
276276
});
277277

278278
attrs.$observe( prefix+'Trigger', function ( val ) {
279-
element.unbind( triggers.show );
280-
element.unbind( triggers.hide );
279+
element.unbind( triggers.show, showTooltipBind );
280+
element.unbind( triggers.hide, hideTooltipBind );
281281

282282
triggers = setTriggers( val );
283283

0 commit comments

Comments
 (0)