How to use the @ember/test-helpers.fillIn 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 cibernox / ember-power-select / addon-test-support / index.js View on Github external
trigger.scrollIntoView();
  }

  let isMultipleSelect = !!trigger.querySelector('.ember-power-select-trigger-multiple-input');

  let contentId = await openIfClosedAndGetContentId(trigger);
  let isDefaultSingleSelect = !!document.querySelector('.ember-power-select-search-input');

  if (isMultipleSelect) {
    await fillIn(trigger.querySelector('.ember-power-select-trigger-multiple-input'), value);
  } else if (isDefaultSingleSelect) {
    await fillIn('.ember-power-select-search-input', value);
  } else { // It's probably a customized version
    let inputIsInTrigger = !!trigger.querySelector('.ember-power-select-trigger input[type=search]');
    if (inputIsInTrigger) {
      await fillIn(trigger.querySelector('input[type=search]'), value);
    } else {
      await fillIn(`#${contentId} .ember-power-select-search-input[type=search]`, 'input');
    }
  }
  return settled();
}
github ember-codemods / ember-test-helpers-codemod / __testfixtures__ / integration / all.output.js View on Github external
test('it renders', async function(assert) {
  this.render(hbs`{{foo-bar}}`);

  await click('.foo');
  assert.equal(this.element.querySelector('.foo').id, 'foo');
  await fillIn('.foo input', 'bar');
  await blur('.foo input');
  assert.equal(this.element.querySelector('.foo').textContent.trim(), 'foo');
});
github ember-codemods / ember-test-helpers-codemod / __testfixtures__ / acceptance / fill-in.output.js View on Github external
test('visiting /foo', async function(assert) {
  await visit('/foo');

  await fillIn('#bar', 'baz');
  await fillIn(this.element.querySelectorAll('#qux input')[5], 'qaaz');
  assert.equal(currentURL(), '/foo');
});
github fossasia / open-event-frontend / tests / helpers / custom-helpers.js View on Github external
export async function login(assert, email = null, password = null, gotoLoginPage = true) {
  if (gotoLoginPage) {
    await visit('/login');
  }
  assert.equal(currentURL(), '/login');
  await fillIn('input[name=email]', email !== null ? email : 'opev-fe@test.com');
  await fillIn('input[name=password]', password !== null ? password : 'test-fe-user');
  await click('button[type=submit]');
  await settled();
}
github ember-codemods / ember-test-helpers-codemod / transforms / native-dom / __testfixtures__ / integration.output.js View on Github external
test('it renders', async function(assert) {
  this.render(hbs`{{foo-bar}}`);

  await click('.foo', {});
  assert.equal(find('.foo').id, 'foo');
  await fillIn('.foo input', 'bar');
  await blur('.foo input');
  assert.equal(find('.foo').textContent.trim(), 'foo');
});
github DefinitelyTyped / DefinitelyTyped / types / ember__test-helpers / ember__test-helpers-tests.ts View on Github external
await tap('.message');
    await focus('.message');
    await blur('.message');
    await triggerEvent('.message', 'custom-event');
    await triggerKeyEvent('.message', 'keydown', 'Enter', { ctrlKey: true });
    await fillIn('.message', 'content');

    const messageElement = find('.message')!;
    await click(messageElement);
    await doubleClick(messageElement);
    await tap(messageElement);
    await focus(messageElement);
    await blur(messageElement);
    await triggerEvent(messageElement, 'custom-event');
    await triggerKeyEvent(messageElement, 'keydown', 'Enter', { ctrlKey: true });
    await fillIn(messageElement, 'content');
    await typeIn(messageElement, 'content');

    const allMessages = findAll('.message');
    for (const element of allMessages) {
        await click(element);
    }

    const root = getRootElement();
    await click(root);
});
github ember-codemods / ember-test-helpers-codemod / __testfixtures__ / integration / all.output.js View on Github external
async function fillInHelper(value) {
  await fillIn('.foo input', value);
  await triggerEvent('.foo input', 'change');
}
github cardstack / cardstack / packages / test-support / addon-test-support / card-ui-helpers.js View on Github external
export async function setFieldValue(name, value) {
  let type = find(`[data-test-field="${name}"]`).getAttribute('data-test-field-type');
  if (type === '@cardstack/core-types::boolean') {
    if (value) {
      await click(`[data-test-field="${name}"] .cardstack-core-types-field-value-true`);
    } else {
      await click(`[data-test-field="${name}"] .cardstack-core-types-field-value-false`);
    }
  } else if (type === '@cardstack/core-types::has-many' && Array.isArray(value)) {
    await fillIn(`#edit-${name}-field-value`, value.join(','));
    await triggerEvent(`#edit-${name}-field-value`, 'keyup');
  } else {
    await fillIn(`#edit-${name}-field-value`, value);
    await triggerEvent(`#edit-${name}-field-value`, 'keyup');
  }
}
github nibynic / ember-form-builder / addon-test-support / accessors / number.js View on Github external
async write(input, value) {
    await fillIn(input.querySelector('input'), value);
  }
};