How to use the @ember/test-helpers.triggerEvent function in @ember/test-helpers

To help you get started, we’ve selected a few @ember/test-helpers 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 ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / event.output.js View on Github external
test('it renders', async function(assert) {
  this.render(hbs`{{foo-bar}}`);

  await triggerEvent('.foo', 'change');
  await triggerEvent('.foo', 'submit');
  await triggerEvent('.foo', 'focusin');
  await triggerEvent('.foo', 'focusout');
  await triggerEvent('.foo', 'mousedown');
  await triggerEvent('.foo', 'mouseenter');
  await triggerEvent('.foo', 'mouseleave');
  await triggerEvent('.foo', 'mousemove');
  await triggerEvent('.foo', 'mouseout');
  await triggerEvent('.foo', 'mouseover');
  await triggerEvent('.foo', 'mouseup');
  await triggerEvent('.foo', 'input');
  await click('.foo');
  assert.ok(true);
});
github ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / event.output.js View on Github external
test('it renders', async function(assert) {
  this.render(hbs`{{foo-bar}}`);

  await triggerEvent('.foo', 'change');
  await triggerEvent('.foo', 'submit');
  await triggerEvent('.foo', 'focusin');
  await triggerEvent('.foo', 'focusout');
  await triggerEvent('.foo', 'mousedown');
  await triggerEvent('.foo', 'mouseenter');
  await triggerEvent('.foo', 'mouseleave');
  await triggerEvent('.foo', 'mousemove');
  await triggerEvent('.foo', 'mouseout');
  await triggerEvent('.foo', 'mouseover');
  await triggerEvent('.foo', 'mouseup');
  await triggerEvent('.foo', 'input');
  await click('.foo');
  assert.ok(true);
});
github mharris717 / ember-drag-drop / test-support / helpers / drag-drop.js View on Github external
export async function drag(dragSelector, options = {}) {
  let dragEvent = new MockEvent(options.dragStartOptions);

  await triggerEvent(dragSelector, 'mouseover');

  await triggerEvent(dragSelector, 'dragstart', dragEvent);

  if (options.afterDrag) {
    await options.afterDrag.call();
  }

  if (options.drop) {
    await drop(dragSelector, dragEvent, options);
  }
}
github adopted-ember-addons / ember-file-upload / addon-test-support / index.js View on Github external
export async function dragAndDrop(selector, ...files) {
  let dropzone = find(selector);
  assert(`Selector '${dropzone}' could not be found.`, dropzone);
  assert(
    'All files must be instances of File/Blob type',
    files.every((file) => file instanceof Blob)
  );

  let dataTransfer = { files };

  await triggerEvent(dropzone, 'dragenter', { dataTransfer });
  await triggerEvent(dropzone, 'dragover', { dataTransfer });
  return triggerEvent(dropzone, 'drop', { dataTransfer });
}
github cardstack / cardstack / packages / test-support / addon-test-support / card-ui-helpers.js View on Github external
export async function dragAndDrop(fieldSelector, dropZoneSelector, options) {
  await triggerEvent(fieldSelector, 'mousedown');
  await triggerEvent(fieldSelector, 'dragstart', options);
  await triggerEvent(dropZoneSelector, 'drop', options);
}
github st-h / ember-content-editable / tests / helpers / fill-content-editable.js View on Github external
export async function fillContentEditable(selector, content) {
  click(selector);
  $(selector).html(content);
  triggerEvent(selector, 'keyup', 13);
  triggerEvent(selector, 'blur');
}
github cibernox / ember-power-select / addon-test-support / helpers.js View on Github external
export async function nativeTouch(selectorOrDomElement) {
  triggerEvent(selectorOrDomElement, 'touchstart');
  return triggerEvent(selectorOrDomElement, 'touchend');
}
github mharris717 / ember-drag-drop / test-support / helpers / drag-drop.js View on Github external
async function dragOver(dropSelector, moves) {
  moves = moves || [[{ clientX: 1, clientY: 1 }, dropSelector]];
  
  for (const move of moves) {
    const position = move[0] || false;
    const selector = move[1] || false;
    const event = new MockEvent(position);
    await triggerEvent(selector || dropSelector, 'dragover', event);
  }
}
github cardstack / cardstack / packages / test-support / addon-test-support / card-ui-helpers.js View on Github external
export async function setCardId(id) {
  await showCardId();
  await fillIn('#card__id', id);
  await triggerEvent('#card__id', 'keyup');
}
github adopted-ember-addons / ember-pikaday / addon-test-support / interactor.js View on Github external
export async function selectDate(date) {
  const day = date.getDate();
  const month = date.getMonth();
  const year = date.getFullYear();
  const selectEvent = 'ontouchend' in document ? 'touchend' : 'mousedown';

  const yearElement = findVisibleElement(YEAR_SELECTOR);
  yearElement.value = year;
  await triggerEvent(yearElement, 'change');

  const monthElement = findVisibleElement(MONTH_SELECTOR);
  monthElement.value = month;
  await triggerEvent(monthElement, 'change');

  await triggerEvent(
    findVisibleElement(
      'td[data-day="' + day + '"]:not(.is-outside-current-month) button'
    ),
    selectEvent
  );
}