updated with tests for event.js