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

Commit

Permalink
fix(popover): don't unbind event handlers created by other directives
Browse files Browse the repository at this point in the history
Closes #456
  • Loading branch information
pkozlowski-opensource committed Jul 23, 2013
1 parent 8dc92af commit 56f624a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions src/popover/test/popoverSpec.js
Expand Up @@ -44,6 +44,28 @@ describe('popover', function() {
elm.trigger( 'click' );
expect( elmScope.tt_isOpen ).toBe( false );
}));

it('should not unbind event handlers created by other directives - issue 456', inject( function( $compile ) {

scope.click = function() {
scope.clicked = !scope.clicked;
};

elmBody = angular.element(
'<div><input popover="Hello!" ng-click="click()" popover-trigger="mouseenter"/></div>'
);
$compile(elmBody)(scope);
scope.$digest();

elm = elmBody.find('input');

elm.trigger( 'mouseenter' );
elm.trigger( 'mouseleave' );
expect(scope.clicked).toBeFalsy();

elm.click();
expect(scope.clicked).toBeTruthy();
}));
});


4 changes: 2 additions & 2 deletions src/tooltip/tooltip.js
Expand Up @@ -276,8 +276,8 @@ angular.module( 'ui.bootstrap.tooltip', [ 'ui.bootstrap.position' ] )
});

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

triggers = setTriggers( val );

Expand Down

0 comments on commit 56f624a

Please sign in to comment.