unit testing - Test keydown event in AngularJS with Jasmine and PhantomJS -


i tried implement solution here function, doesn't work, everytime have oevent.keycode = 0

in unit tests keydown event triggered, can't test if specific key pressed.

solution:
worked me phantomjs 1.9.8

function simulatekeydownevent(element, keycode) {     var event = document.createevent("events");     event.initevent("keydown", true, true);     event.keycode = keycode;     element.dispatchevent(event); } 


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -