<commit_before>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find, triggerEvent } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import ToolTipComponent from '@zestia/ember-async-tooltips/components/tool-tip';

module('tool-tip', function(hooks) {
  setupRenderingTest(hooks);

  test('it renders', async function(assert) {
    assert.expect(4);

    await render(hbs`{{tool-tip text="Hello World"}}`);

    const el = find('.tooltip');

    assert.ok(el,
      'tooltips have an appropriate class name');

    assert.ok(el.classList.contains('is-showing'),
      'a tooltip will be showing by default (to animate itself in)');

    assert.equal(el.getAttribute('role'), 'tooltip',
      'tooltip components have a suitable aria role');

    assert.equal(el.innerHTML, 'Hello World',
      'renders value of text attribute');
  });

  test('on insert action', async function(assert) {
    assert.expect(1);

    this.set('inserted', tooltip => {
      assert.ok(tooltip instanceof ToolTipComponent,
        'when a tooltip is inserted into the DOM, it sends an action with a ' +
        'reference to itself');
    });

    await render(hbs`{{tool-tip _onInsert=(action inserted)}}`);
  });

  test('on mouse leave action', async function(assert) {
    assert.expect(1);

    this.set('mouseExited', function() {
      assert.ok(true, 'when a the mouse leaves a tooltip it sends an action');
    });

    await render(hbs`{{tool-tip _onMouseLeave=(action mouseExited)}}`);

    await triggerEvent('.tooltip', 'mouseout');
  });
});<commit_msg>remove use of action helper<commit_after>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render, find, triggerEvent } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';
import ToolTipComponent from '@zestia/ember-async-tooltips/components/tool-tip';

module('tool-tip', function(hooks) {
  setupRenderingTest(hooks);

  test('it renders', async function(assert) {
    assert.expect(4);

    await render(hbs`{{tool-tip text="Hello World"}}`);

    const el = find('.tooltip');

    assert.ok(el,
      'tooltips have an appropriate class name');

    assert.ok(el.classList.contains('is-showing'),
      'a tooltip will be showing by default (to animate itself in)');

    assert.equal(el.getAttribute('role'), 'tooltip',
      'tooltip components have a suitable aria role');

    assert.equal(el.innerHTML, 'Hello World',
      'renders value of text attribute');
  });

  test('on insert action', async function(assert) {
    assert.expect(1);

    this.set('inserted', tooltip => {
      assert.ok(tooltip instanceof ToolTipComponent,
        'when a tooltip is inserted into the DOM, it sends an action with a ' +
        'reference to itself');
    });

    await render(hbs`{{tool-tip _onInsert=this.inserted}}`);
  });

  test('on mouse leave action', async function(assert) {
    assert.expect(1);

    this.set('mouseExited', function() {
      assert.ok(true, 'when a the mouse leaves a tooltip it sends an action');
    });

    await render(hbs`{{tool-tip _onMouseLeave=this.mouseExited}}`);

    await triggerEvent('.tooltip', 'mouseout');
  });
});
{'fraction_non_alphanumeric': 0.14644607843137256, 'fraction_numerical': 0.001838235294117647, 'mean_word_length': 3.865871833084948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '244708', 'n_tokens_mistral': 980, 'n_tokens_neox': 975, 'n_words': 270}