<commit_before>/*global describe, beforeEach, afterEach, it */

describe("EventSim", function () {

  it("should work", function () {
    expect(true).to.be(true);
  });

  function testMouseEvent(name) {
    it("should simulate " + name + " events", function (done) {
      var listener = function (e) {
        expect(e.pageX).to.be(400);
        expect(e.pageY).to.be(300);
        expect(e.x).to.be(400);
        expect(e.y).to.be(300);
        expect(e.altKey).to.be(true);
        expect(e.shiftKey).to.be(true);
        expect(e.metaKey).to.be(true);
        expect(e.ctrlKey).to.be(true);
        document.body.removeEventListener(name, listener);
        done();
      };
      document.body.addEventListener(name, listener);
      var options = {
        clientX: 400,
        clientY: 300,
        altKey: true,
        shiftKey: true,
        metaKey: true,
        ctrlKey: true
      };
      EventSim.simulate(document.body, name, options);
    });
  }

  describe("MouseEvents", function () {
    var mouseEvents = [ "click", "dblclick", "mouseup", "mousedown", "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave" ];
    mouseEvents.forEach(testMouseEvent, this);
  });

  function testKeyboardEvent(name) {
    it("should simulate " + name + " events", function (done) {
      var listener = function (e) {
        console.log(e);
        expect(e.keyIdentifier).to.be("a");
        expect(e.altKey).to.be(true);
        expect(e.shiftKey).to.be(true);
        expect(e.metaKey).to.be(true);
        expect(e.ctrlKey).to.be(true);
        document.body.removeEventListener(name, listener);
        done();
      };
      document.body.addEventListener(name, listener);
      var options = {
        key: "a",
        altKey: true,
        shiftKey: true,
        metaKey: true,
        ctrlKey: true
      };
      EventSim.simulate(document.body, name, options);
    });
  }

  describe("KeyboardEvents", function () {
    var keyboardEvents = [ "keyup", "keydown", "keypress" ];
    keyboardEvents.forEach(testKeyboardEvent, this);
  });
});
<commit_msg>make the keyboard tests match the DOM Level3 spec<commit_after>/*global describe, beforeEach, afterEach, it */

describe("EventSim", function () {

  it("should work", function () {
    expect(true).to.be(true);
  });

  function testMouseEvent(name) {
    it("should simulate " + name + " events", function (done) {
      var listener = function (e) {
        expect(e.pageX).to.be(400);
        expect(e.pageY).to.be(300);
        expect(e.x).to.be(400);
        expect(e.y).to.be(300);
        expect(e.altKey).to.be(true);
        expect(e.shiftKey).to.be(true);
        expect(e.metaKey).to.be(true);
        expect(e.ctrlKey).to.be(true);
        document.body.removeEventListener(name, listener);
        done();
      };
      document.body.addEventListener(name, listener);
      var options = {
        clientX: 400,
        clientY: 300,
        altKey: true,
        shiftKey: true,
        metaKey: true,
        ctrlKey: true
      };
      EventSim.simulate(document.body, name, options);
    });
  }

  describe("MouseEvents", function () {
    var mouseEvents = [ "click", "dblclick", "mouseup", "mousedown", "mousemove", "mouseover", "mouseout", "mouseenter", "mouseleave" ];
    mouseEvents.forEach(testMouseEvent, this);
  });

  function testKeyboardEvent(name) {
    it("should simulate " + name + " events", function (done) {
      var listener = function (e) {
        console.log(e);
        expect(e.key).to.be("a");
        expect(e.char).to.be("A");
        expect(e.altKey).to.be(true);
        expect(e.shiftKey).to.be(true);
        expect(e.metaKey).to.be(true);
        expect(e.ctrlKey).to.be(true);
        document.body.removeEventListener(name, listener);
        done();
      };
      document.body.addEventListener(name, listener);
      var options = {
        key: "a",
        char: "A",
        altKey: true,
        shiftKey: true,
        metaKey: true,
        ctrlKey: true
      };
      EventSim.simulate(document.body, name, options);
    });
  }

  describe("KeyboardEvents", function () {
    var keyboardEvents = [ "keyup", "keydown", "keypress" ];
    keyboardEvents.forEach(testKeyboardEvent, this);
  });
});

{'fraction_non_alphanumeric': 0.1636876763875823, 'fraction_numerical': 0.008701787394167451, 'mean_word_length': 2.5353283458021614, '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': '6113599', 'n_tokens_mistral': 1382, 'n_tokens_neox': 1343, 'n_words': 241}