Added features and tests for events.js