Skip to content

Instantly share code, notes, and snippets.

@bunnymatic
Created July 15, 2012 00:48
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 bunnymatic/3114142 to your computer and use it in GitHub Desktop.
Save bunnymatic/3114142 to your computer and use it in GitHub Desktop.
Jasmine Helpers to fire events with Prototype
var jasmine = jasmine || {}
jasmine.getEvents = function(sel, event_name) {
var events = [];
try {
var evs = $$(sel)[0].getStorage().get('prototype_event_registry');
events = evs.get(event_name);
}
catch(e) {}
return events;
};
jasmine.triggerEvent = function(sel, event_name) {
var events = jasmine.getEvents(sel, event_name);
_.each(events, function(ev) {
_.each($$(sel), function(el) {
ev.apply(el);
});
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment