How to use the ember-keyboard/fixtures/mouse-buttons-array.indexOf function in ember-keyboard

To help you get started, we’ve selected a few ember-keyboard 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 briarsweetbriar / ember-keyboard / addon-test-support / key-event.js View on Github external
const event = keys.reduce((event, attribute) => {
    const isValidModifier = validModifiers.indexOf(attribute) > -1;

    if (isValidModifier) {
      attribute = attribute === 'cmd' ? getCmdKey() : attribute;

      event[`${attribute}Key`] = true;
    } else if (validMouseButtons.indexOf(attribute) > -1) {
      event.button = getMouseCode(attribute);
    } else {
      const keyCode = getKeyCode(attribute);

      event.code = attribute;

      // deprecated / removed from the Web Standards
      event.which = keyCode;
      event.keyCode = keyCode;
    }

    return event;
  }, {});
github briarsweetbriar / ember-keyboard / test-support / helpers / ember-keyboard / register-test-helpers.js View on Github external
const event = (attributes || '').split('+').reduce((event, attribute) => {
    if (validModifiers.indexOf(attribute) > -1) {
      attribute = attribute === 'cmd' ? getCmdKey() : attribute;
      event[`${attribute}Key`] = true;
    } else if (validMouseButtons.indexOf(attribute) > -1) {
      event.button = getMouseCode(attribute);
    } else {
      event.keyCode = getKeyCode(attribute);
    }

    return event;
  }, {});