happen wraps the createEvent DOM API to make real
event mocking in-browser palatable.

Installation

Raw:

wget https://raw.github.com/tmcw/happen/master/src/happen.js

With component

component install tmcw/happen

Native API

var element = document.getElementById('map');

// click shortcut
happen.click(element);

// dblclick shortcut
happen.dblclick(element);

// custom options
happen.dblclick(element, { shift: true });

jQuery Plugin

// Shortcut - 'click' is shorthand for { type: 'click' }
$('.foo').happen('click');

// Longhand - specify any sort of properties
$('.foo').happen({ type: 'keyup', keyCode: 50 });

// Works on any jQuery selection
$('.foo, .bar').happen('dblclick');

Shortcuts:

Use it with a testing framework, like Jasmine
or Mocha.

See Also

Licensed BSD.