<commit_before>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import { run } from '@ember/runloop';
import hbs from 'htmlbars-inline-precompile';

module('pop-over', function(hooks) {
  setupRenderingTest(hooks);

  hooks.beforeEach(function() {
    this.setup = function() {
      this.click = function (selector) {
        let $el = this.$(selector);
        run($el, 'mousedown');
        this.focus(selector);
        run($el, 'mouseup');
        run($el, 'click');
      };

      this.focus = function (selector) {
        let $el = this.$(selector);
        if (!document.hasFocus || document.hasFocus()) {
          run($el, 'focus');
        } else {
          run($el, 'trigger', 'focusin');
        }
      };
    };
  });


  test('classNames are applied when pointer and orientation are set', async function(assert) {
    assert.expect(5);

    assert.hasClasses = function (element, classes) {
      let actual = element.prop('class').split(' ');
      let expected = classes.split(' ');
      assert.ok(
        actual.length === expected.length && expected.reduce(function (hasAll, expected) {
          return hasAll && actual.indexOf(expected) !== -1;
        }, true)
      );
    }

    this.owner.register('pop-over-constraint:test', [{
      orientation: 'top',
      pointer: 'center',
      solveFor() { return true; }
    }], { instantiate: false });

    await render(
      hbs`{{pop-over for="ember-testing" on='click' flow='test' orientation=orientation pointer=pointer active=active supportsLiquidFire=false}}`
    );

    this.set('active', true);

    let $ = this.$('.pop-over');
    assert.hasClasses($, 'ember-view pop-over');

    this.set('orientation', 'above');
    assert.hasClasses($, 'ember-view pop-over orient-above');

    this.set('orientation', 'below');
    this.set('pointer', 'center');
    assert.hasClasses($, 'ember-view pop-over orient-below pointer-center');

    this.set('orientation', null);
    this.set('pointer', 'left');
    assert.hasClasses($, 'ember-view pop-over pointer-left');

    this.set('pointer', null);
    assert.hasClasses($, 'ember-view pop-over');
  });
});<commit_msg>chore: remove unnecessary `hasClassses` assert helper<commit_after>import { module, test } from 'qunit';
import { setupRenderingTest } from 'ember-qunit';
import { render } from '@ember/test-helpers';
import hbs from 'htmlbars-inline-precompile';

module('pop-over', function(hooks) {
  setupRenderingTest(hooks);

  test('classNames are applied when pointer and orientation are set', async function(assert) {
    this.owner.register('pop-over-constraint:test', [{
      orientation: 'top',
      pointer: 'center',
      solveFor() { return true; }
    }], { instantiate: false });

    await render(hbs`
      {{pop-over for="ember-testing" on='click' flow='test' orientation=orientation pointer=pointer active=active supportsLiquidFire=false}}
    `);

    this.set('active', true);

    this.set('orientation', 'above');
    assert.dom('.pop-over').hasClass('orient-above');

    this.set('orientation', 'below');
    assert.dom('.pop-over').hasClass('orient-below');

    this.set('pointer', 'center');
    assert.dom('.pop-over').hasClass('pointer-center');

    this.set('orientation', null);
    assert.dom('.pop-over').doesNotHaveClass('orient-below');

    this.set('pointer', 'left');
    assert.dom('.pop-over').hasClass('pointer-left');

    this.set('pointer', null);
    assert.dom('.pop-over').doesNotHaveClass('pointer-left');
  });
});
{'fraction_non_alphanumeric': 0.18037357122943964, 'fraction_numerical': 0.0005575689991636465, 'mean_word_length': 3.435105067985167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2219002', 'n_tokens_mistral': 1099, 'n_tokens_neox': 1071, 'n_words': 219}