Fix tests
Fix mocha globals for window event listener