Created
July 20, 2016 10:12
-
-
Save ronapelbaum/ed29d0d51364a9a6de9e118d46da34ba to your computer and use it in GitHub Desktop.
test angular directives dom events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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