title: How to test document.addEventListener('keydown', cb) with Mocha & Sinon?
body: <p>I'm trying to figure out the best way for testing this method:</p>
  
  <pre><code>document.addEventListener("keydown", function (event) {
      var modifiers = event.altKey || event.ctrlKey || event.metaKey ||
                      event.shiftKey;
      var mapped    = map[event.which];
  
      if (!modifiers) {
        if (mapped !== undefined) {
          event.preventDefault();
          self.emit("move", mapped);
        }
      }
    });
  </code></pre>
  
  <p>I'd like to ensure that if the keys are modifiers or if the keys are not mapped, nothing happens, however, if they are, to spy on the <code>self.emit</code> function.</p>