How to use the @ember/test-helpers.findAll 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 / acceptance / __testfixtures__ / selected.output.js View on Github external
test(':selected is replaced correctly', function(assert) {
  // find
  const checkedVal = find('.foo input:checked').value;
  assert.equal(checkedVal, 13);

  // findAll
  const checkedCount = findAll('select option:checked').length;
  assert.equal(checkedCount, 3);
});
github ember-codemods / ember-test-helpers-codemod / transforms / acceptance / __testfixtures__ / each.output.js View on Github external
test('function callback with two args', function(assert) {
  const elemIds = findAll('.button-class').forEach(function(elem, i) {
    assert.equal(element.id, `button${index}`);
  });
});
github ember-codemods / ember-test-helpers-codemod / transforms / acceptance / __testfixtures__ / get.output.js View on Github external
test('transforms get() correctly', function(assert) {
  assert.ok(findAll('.foo bar')[3]);

  const otherGet = someOtherObj.get(1);
});
github ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / each.output.js View on Github external
test('anonymous function callback with two args', function(assert) {
  this.render(hbs`{{foo-bar}}`);

  const elemIds = findAll('.button-class').forEach((val, i) => {
    assert.equal(element.id, `button${index}`);
  });
});
github ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / get.output.js View on Github external
test('transforms get() correctly', function(assert) {
  assert.ok(findAll('.foo')[1]);

  const otherGet = someOtherObj.get(1);
});
github jelhan / croodle / tests / helpers / poll-participate.js View on Github external
export default async function(name, selections) {
  if (!isEmpty(name)) {
    await fillIn('.participation .name input', name);
  }

  const isFreeText = findAll('.participation .selections .radio').length > 0 ? false : true;
  for (let [index, selection] of selections.entries()) {
    if (!isEmpty(selection)) {
      if (isFreeText) {
        await fillIn(`.participation .selections .form-group:nth-child(${index + 1}) input`, selection);
      } else {
        await click(`.participation .selections .form-group:nth-child(${index + 1}) .${selection}.radio input`);
      }
    }
  }

  await click('.participation button[type="submit"]');

  await settled();
}
github emberobserver / client / tests / helpers / find-by-text.js View on Github external
export default function findByText(selectorOrElements, text) {
  let elements = selectorOrElements;
  if (typeof selectorOrElements === 'string') {
    elements = findAll(selectorOrElements);
  }
  return elements.find((el) => el.textContent.includes(text));
}
github ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / jq-extensions.output.js View on Github external
assert.ok(this.$('.foo:parent').length);
  assert.ok(this.$('.foo:password').length);
  assert.ok(this.$('.foo:radio').length);
  assert.ok(this.$('.foo:reset').length);
  assert.ok(findAll('.foo:checked').length);
  assert.ok(this.$(':selected').length);
  assert.ok(this.$('.foo:submit').length);
  assert.ok(this.$('.foo:text').length);
  assert.ok(this.$('.foo:visible').length);
  assert.ok(this.$(JQEXTENSION_SELECTOR_AS_LOCAL_CONST).length);
  assert.ok(this.$(ANY_SELECTOR_AS_IMPORTED_CONST).length);

  assert.ok(this.$(':eq(0)').length);
  assert.ok(findAll(find('.foo')).length);
  assert.ok(findAll('.foo')[1].length);
  assert.ok(findAll('.foo:first-child').length);
  assert.ok(findAll('.foo:last-child').length);
  assert.ok(findAll(NORMAL_SELECTOR).length);
  assert.ok(this.$(NORMAL_PSEUDO_SELECTOR).length);
});
github machty / ember-concurrency / tests / helpers / generator-tests.js View on Github external
const find = wrap(function * (app, selector, options = {}) {
  let startedAt = + new Date();
  let timeoutMs = options.timeout;
  let count = typeof options.count === 'undefined' ? 1 : options.count;

  let isSettled = false;
  settled().then(() => {
    isSettled = true;
  });

  while(true) {
    let els = findAll(selector);

    if (els.length === count) {
      return raw([...els]);
    } else {
      if (timeoutMs) {
        let now = + new Date();
        if (now - startedAt > timeoutMs) {
          throw new Error(`Tried to find ${count} occurrence(s) of "${selector}" within ${timeoutMs}ms, instead found ${els.length}`);
        }
      } else {
        if (isSettled) {
          throw new Error(`Tried to find ${count} occurrence(s) of "${selector}" before test waiters settled, instead found ${els.length}`);
        }
      }

      yield rawTimeout(15);
github ember-codemods / ember-test-helpers-codemod / transforms / integration / __testfixtures__ / jq-extensions.output.js View on Github external
assert.ok(this.$('.foo:password').length);
  assert.ok(this.$('.foo:radio').length);
  assert.ok(this.$('.foo:reset').length);
  assert.ok(findAll('.foo:checked').length);
  assert.ok(this.$(':selected').length);
  assert.ok(this.$('.foo:submit').length);
  assert.ok(this.$('.foo:text').length);
  assert.ok(this.$('.foo:visible').length);
  assert.ok(this.$(JQEXTENSION_SELECTOR_AS_LOCAL_CONST).length);
  assert.ok(this.$(ANY_SELECTOR_AS_IMPORTED_CONST).length);

  assert.ok(this.$(':eq(0)').length);
  assert.ok(findAll(find('.foo')).length);
  assert.ok(findAll('.foo')[1].length);
  assert.ok(findAll('.foo:first-child').length);
  assert.ok(findAll('.foo:last-child').length);
  assert.ok(findAll(NORMAL_SELECTOR).length);
  assert.ok(this.$(NORMAL_PSEUDO_SELECTOR).length);
});