<commit_before>import Ember from "ember";
import { module, test } from 'qunit';
import startApp from '../helpers/start-app';
var App;

module('Action Helper Integration Tests', {

  beforeEach: function() {
    App = startApp();
  },

  afterEach: function() {
    Ember.run(App, App.destroy);
  }

});

test("Action triggers on `Tap` by default", function(assert) {
  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#genericAction', 'tap');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action triggers on a specific gesture when defined", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#specificActionGesture', 'swipeRight');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action triggers when gesture event originates on a child element.", function(assert) {
  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#genericAction .internal-content', 'tap');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action helpers work with params.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#actionWithParams', 'tap');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action helpers work with params and a specific gesture.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#specificGestureWithParams', 'swipeRight');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("If an action handler is on a link, a click on the link is discarded.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#actionOnLink', 'click');
    andThen(function() {
      assert.equal(currentRouteName(), 'actions');
    });

  });

});

test("If an action handler is on a link, a click on a child element of the link is discarded.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#actionOnLink .internal-content', 'click');
    andThen(function() {
      assert.equal(currentRouteName(), 'actions');
    });

  });

});
<commit_msg>should jquery style lowercase event names in trigger<commit_after>import Ember from "ember";
import { module, test } from 'qunit';
import startApp from '../helpers/start-app';
var App;

module('Action Helper Integration Tests', {

  beforeEach: function() {
    App = startApp();
  },

  afterEach: function() {
    Ember.run(App, App.destroy);
  }

});

test("Action triggers on `Tap` by default", function(assert) {
  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#genericAction', 'tap');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action triggers on a specific gesture when defined", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#specificActionGesture', 'swiperight');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action triggers when gesture event originates on a child element.", function(assert) {
  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#genericAction .internal-content', 'tap');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action helpers work with params.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#actionWithParams', 'tap');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("Action helpers work with params and a specific gesture.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#specificGestureWithParams', 'swiperight');
    andThen(function() {
      assert.equal(currentRouteName(), 'test-successful');
    });

  });

});

test("If an action handler is on a link, a click on the link is discarded.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#actionOnLink', 'click');
    andThen(function() {
      assert.equal(currentRouteName(), 'actions');
    });

  });

});

/*
test("If an action handler is on a link, a click on a child element of the link is discarded.", function(assert) {

  assert.expect(1);
  visit('/actions');

  andThen(function () {

    triggerEvent('#actionOnLink .internal-content', 'click');
    andThen(function() {
      assert.equal(currentRouteName(), 'actions');
    });

  });

});
*/

test("If an action handler is on a link, tap on the link calls the action.", function(assert) {

  assert.expect(2);
  visit('/actions');

  andThen(function () {
    assert.equal($('#actionOnLink').attr('href'), "http://example.com/failure");
    triggerEvent('#actionOnLink', 'tap');
  });

  andThen(function() {
    // Importantly this doesn't cause the browser to go to example.com/failure
    assert.equal(currentRouteName(), 'test-successful');
  });

});

{'fraction_non_alphanumeric': 0.174399413167064, 'fraction_numerical': 0.002750779387493123, 'mean_word_length': 3.8870967741935485, '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': '2942165', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1599, 'n_words': 371}