Skip to content

Instantly share code, notes, and snippets.

@pennyfx
Created November 8, 2013 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pennyfx/7379441 to your computer and use it in GitHub Desktop.
Save pennyfx/7379441 to your computer and use it in GitHub Desktop.
click eventsssssss
var clickTouch = false;
var clickHandler = function(e){
clickTouch = e.touches;
}
document.addEventListener('mousedown', clickHandler);
waitsFor(function(){
return clickTouch !== false;
});
var me = document.createEvent('MouseEvent');
me.initMouseEvent('mousedown', true, true, window, {}, 0,0,0,0,false, false, false, false, 0, null);
document.dispatchEvent(me);
runs(function(){
expect(clickTouch instanceof Array).toEqual(true);
});
document.removeEventListener('mousedown', clickHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment