How to use the atom-keymap.buildKeydownEvent function in atom-keymap

To help you get started, we’ve selected a few atom-keymap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atom / atom / spec / window-event-handler-spec.js View on Github external
it('dispatches the event via the KeymapManager and CommandRegistry', () => {
      const dispatchedCommands = [];
      atom.commands.onWillDispatch(command => dispatchedCommands.push(command));
      atom.commands.add('*', { 'foo-command': () => {} });
      atom.keymaps.add('source-name', { '*': { x: 'foo-command' } });

      const event = KeymapManager.buildKeydownEvent('x', {
        target: document.createElement('div')
      });
      document.dispatchEvent(event);

      expect(dispatchedCommands.length).toBe(1);
      expect(dispatchedCommands[0].type).toBe('foo-command');
    }));

atom-keymap

Atom's DOM-aware keymap module

MIT
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis

Similar packages