How to use the @ember/test-helpers.find 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__ / 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);

  // Multiple jQuery selectors
  const firstChecked = find('.foo input:checked').value;
  const secondChecked = find(findAll('.foo input:checked')[2]).value;
});
github ember-codemods / ember-test-helpers-codemod / transforms / acceptance / __testfixtures__ / prop.output.js View on Github external
test('visiting /foo', function(assert) {
  assert.equal(find('.foo').tagName, 'DIV');
});
github ember-codemods / ember-test-helpers-codemod / transforms / acceptance / __testfixtures__ / attr.output.js View on Github external
test('visiting /foo', function(assert) {
  assert.equal(find('.foo').id, 'foo');
  assert.equal(find('.foo').getAttribute('data-test'), 'foo');
});
github DefinitelyTyped / DefinitelyTyped / types / ember__test-helpers / ember__test-helpers-tests.ts View on Github external
test('DOM interactions', async () => {
    await render(hbs`<div class="message">Hello, world</div>`);

    await click('.message');
    await doubleClick('.message');
    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();
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 mharris717 / ember-drag-drop / test-support / helpers / drag-drop.js View on Github external
async function drop(dragSelector, dragEvent, options) {
  let { drop: dropSelector, dropEndOptions, dragOverMoves } = options;

  let dropElement = await find(dropSelector);
  if (!dropElement) {
    throw(`There are no drop targets by the given selector: '${dropSelector}'`);
  }

  await dragOver(dropSelector, dragOverMoves);

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

  let event = new MockEvent().useDataTransferData(dragEvent);
  await triggerEvent(dropSelector, 'drop', event);

  return await triggerEvent(dragSelector, 'dragend', dropEndOptions);
}
github froala / ember-froala-editor / addon-test-support / helpers / get-in-froala-editor.js View on Github external
export function getInFroalaEditor(selector) {

  let element = find(`${selector} [contenteditable]`) || find(selector);

  if (element === null) {
      throw `getInFroalaEditor(): DOM element not found with the selector '${selector}'`;
  }

  return element.innerHTML.trim();

}
github ember-infinity / ember-infinity / tests / helpers / assert-acceptance-details.js View on Github external
export default async function assertDetails(assert, {title, listLength, reachedInfinity}) {
  let postsTitle     = find('#posts-title');
  let postList       = find('ul');
  let infinityLoader = find('.infinity-loader');

  await settled();

  assert.equal(postsTitle.textContent, title);
  assert.equal(postList.querySelectorAll('li').length, listLength);
  assert.equal(infinityLoader.classList.contains('reached-infinity'), reachedInfinity);
}
github cardstack / cardstack / packages / test-support / addon-test-support / test-helpers.js View on Github external
export async function saveEdits() {
  let button = find('[data-test-cs-version-control-button-save]');
  if (!button) {
    throw new Error('Could not find save button. Did you open the tools?');
  }
  if (button.disabled) {
    throw new Error('Could not save the edits because the save button is disabled.');
  }

  await click(button);
}