How to use the ember-test-helpers/wait 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 ciena-frost / ember-frost-core / addon-test-support / frost-select.js View on Github external
export function open (hook = 'select') {
  // In a real browser when you click on the select with your mouse a
  // focusin event is fired on the component. However when using jQuery's
  // click() method the focusin is not fired so we are programitcally
  // triggering that in this test.
  $hook(hook).click().trigger('focusin')
  return wait()
}
github html-next / vertical-collection / tests / helpers / array.js View on Github external
destItemIdx = items.indexOf(destItem) + 1;
      items.insertAt(destItemIdx, sourceItem);
    } else {
      // native array
      destItem = items[destItemIdx];
      sourceItem = items[sourceItemIdx];
      items.splice(sourceItemIdx, 1);
      destItemIdx = items.indexOf(destItem) + 1;
      items.splice(destItemIdx, 0, sourceItem);
      // if we are not using Ember Arrays we need to set `items` to a new array
      // instance to trigger a recompute on `virtualComponents`
      context.set('items', [].concat(items));
    }
  });

  return wait();
}
github Addepar / ember-table / tests / helpers / wait-for-render.js View on Github external
export default function() {
  return wait().then(() => {
    return new EmberPromise((resolve) => {
      // Two RAFs needed since we take 3 frames to do the initial render
      requestAnimationFrame(() => requestAnimationFrame((resolve)));
    });
  });
}
github cibernox / ember-native-dom-helpers / addon-test-support / flush-scroll-and-wait.js View on Github external
export function flushScrollAndWait() {
  return wait().then(() => {
    return new Ember.RSVP.Promise((resolve) => {
      window.requestAnimationFrame(resolve);
    });
  });
}
github ember-cli / ember-twiddle / tests / helpers / wait-for-unloaded-iframe.js View on Github external
export default function(app) {
  let ctx = { app };
  Test.registerWaiter(ctx, hasNoIframe);

  return wait().then(() => {
    Test.unregisterWaiter(ctx, hasNoIframe);
    return RSVP.resolve();
  }).then(() => {
    return new RSVP.Promise(function (resolve) {
      run.later(resolve, 10);
    });
  });
}
github html-next / vertical-collection / tests / helpers / array.js View on Github external
export function replaceArray(context, items) {
  const oldItems = context.get('items');

  run(() => {
    if (EmberArray.detect(oldItems)) {
      context.set('items', A(items));
    } else {
      context.set('items', items);
    }
  });

  return wait();
}
github html-next / vertical-collection / tests / helpers / array.js View on Github external
export function append(context, itemsToAppend) {
  const items = context.get('items');

  run(() => {
    if (items.pushObjects) {
      items.pushObjects(itemsToAppend);
    } else {
      context.set('items', items.concat(itemsToAppend));
    }
  });

  return wait();
}
github ciena-frost / ember-frost-bunsen / test-support / helpers / ember-frost-bunsen / renderers / when.js View on Github external
const hookName = `${hook}-${bunsenId}`
  const radioButtonHook = `${hookName}-radio-group-button-input`

  const defaults = {
    buttonNumber: 1
  }

  state = merge(defaults, state)

  if (state.buttonNumber === 1) {
    $hook(radioButtonHook).first().trigger('click')
  } else {
    $hook(radioButtonHook).last().trigger('click')
  }

  return wait()
}
github ciena-frost / ember-frost-core / addon-test-support / frost-select.js View on Github external
export function close (hook = 'select') {
  $hook(hook).click().trigger('focusout')
  return wait()
}