Skip to content

Instantly share code, notes, and snippets.

@ronapelbaum
Created July 20, 2016 10:12
Show Gist options
  • Select an option

  • Save ronapelbaum/ed29d0d51364a9a6de9e118d46da34ba to your computer and use it in GitHub Desktop.

Select an option

Save ronapelbaum/ed29d0d51364a9a6de9e118d46da34ba to your computer and use it in GitHub Desktop.
test angular directives dom events
describe('greet directive spec', function() {
var element;
beforeEach(module('utils'));
beforeEach(inject(function($compile, $rootScope) {
element = angular.element('<hover></hover>');
$compile(element)($rootScope.$new());
}));
it('should call console log on mouseover', function() {
spyOn(console, 'log');
dispatchEvent(element.find('div')[0], 'mouseover');
expect(console.log).toHaveBeenCalledWith('over');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment