I'm having trouble testing my directive with an ng-mouseenter directive.
I'd like to test several things, but first off, I need to test that the method supplied to ng-mouseenter is called.
my test:
describe('hover tests', function () {
it('the triggerPopover method should be called on hover', function() {
spyOn($scope, 'triggerPopover');
var ars = jQuery(view.find('article.the-class-im-looking-for'));
jQuery(ars[0]).trigger('mouseenter');
expect($scope.triggerPopover).toHaveBeenCalled();
});
});
my directive use:
<article my-directive ng-mouseenter="triggerPopover();"></article>
Result:
Expected spy triggerPopover to have been called. The ng-mouseenter stuff doesn't seem to get called