Strip trailing whitespace
Add test for registering a custom event