<commit_before>'use strict';

var dom = require('../../src/lib/dom');

describe('Dom', () => {
  describe('#attachEvents', () => {
    it('should be a function', () => {
      assert.typeOf(dom.attachEvents, 'function', 'attachEvents should be a function');
    });
  });

  describe('#getElement', () => {
    it('should be a function', () => {
      assert.typeOf(dom.getElement, 'function', 'getElement should be a function');
    });

    it('should get an id element', () => {
      var querySelectorSpy = sinon.spy(document, 'querySelector');

      dom.getElement('#id');

      assert.isTrue(querySelectorSpy.called, 'document.querySelector was called');
    });

    it('should get a class element', () => {
      var querySelectorAllSpy = sinon.spy(document, 'querySelectorAll');

      dom.getElement('.class');

      assert.isTrue(querySelectorAllSpy.called, 'document.querySelectorAll was called');
    });
  });

  describe('#getElementNameAndType', () => {
    it('should be a function', () => {
      assert.typeOf(dom.getElementNameAndType, 'function', 'getElementNameAndType should be a function');
    });

    it('should get the name of the element', () => {
      var actualResult = dom.getElementNameAndType('h1');
      var expectedResult = {
        name: 'h1'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });

    it('should get the name and id of the element', () => {
      var actualResult = dom.getElementNameAndType('h1#foo');
      var expectedResult = {
        name: 'h1',
        id: 'foo'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });

    it('should get the name and class of the element', () => {
      var actualResult = dom.getElementNameAndType('h1.foo');
      var expectedResult = {
        name: 'h1',
        class: 'foo'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });

    it('should get the name, id and class of the element', () => {
      var actualResult = dom.getElementNameAndType('h1#foo.bar');
      var expectedResult = {
        name: 'h1',
        id: 'foo',
        class: 'bar'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });
  });

  describe('#getElementType', () => {
    it('should be a function', () => {
      assert.typeOf(dom.getElementType, 'function', 'getElementType should be a function');
    });

    it('should get the type of a given element (id)', () => {
      var actualResult = dom.getElementType('#foo');
      var expectedResult = 'id';

      assert.strictEqual(actualResult, expectedResult, 'actualResult should be equal to expectedResult');
    });

    it('should get the type of a given element (class)', () => {
      var actualResult = dom.getElementType('.foo');
      var expectedResult = 'class';

      assert.strictEqual(actualResult, expectedResult, 'actualResult should be equal to expectedResult');
    });

    it('should get the type of a given element (tag)', () => {
      var actualResult = dom.getElementType('foo');
      var expectedResult = 'tag';

      assert.strictEqual(actualResult, expectedResult, 'actualResult should be equal to expectedResult');
    });
  });

  describe('#live', () => {
    it('should be a function', () => {
      assert.typeOf(dom.live, 'function', 'live should be a function');
    });
  });

  describe('#newElement', () => {
    it('should be a function', () => {
      assert.typeOf(dom.newElement, 'function', 'newElement should be a function');
    });

    it('should create a new element', () => {
      var createElementSpy = sinon.spy(document, 'createElement');
      var h1 = dom.newElement('h1');

      assert.isTrue(createElementSpy.called, 'document.createElementSpy was called');
    });
  });
});
<commit_msg>Removing live function test<commit_after>'use strict';

var dom = require('../../src/lib/dom');

describe('Dom', () => {
  describe('#attachEvents', () => {
    it('should be a function', () => {
      assert.typeOf(dom.attachEvents, 'function', 'attachEvents should be a function');
    });
  });

  describe('#getElement', () => {
    it('should be a function', () => {
      assert.typeOf(dom.getElement, 'function', 'getElement should be a function');
    });

    it('should get an id element', () => {
      var querySelectorSpy = sinon.spy(document, 'querySelector');

      dom.getElement('#id');

      assert.isTrue(querySelectorSpy.called, 'document.querySelector was called');
    });

    it('should get a class element', () => {
      var querySelectorAllSpy = sinon.spy(document, 'querySelectorAll');

      dom.getElement('.class');

      assert.isTrue(querySelectorAllSpy.called, 'document.querySelectorAll was called');
    });
  });

  describe('#getElementNameAndType', () => {
    it('should be a function', () => {
      assert.typeOf(dom.getElementNameAndType, 'function', 'getElementNameAndType should be a function');
    });

    it('should get the name of the element', () => {
      var actualResult = dom.getElementNameAndType('h1');
      var expectedResult = {
        name: 'h1'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });

    it('should get the name and id of the element', () => {
      var actualResult = dom.getElementNameAndType('h1#foo');
      var expectedResult = {
        name: 'h1',
        id: 'foo'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });

    it('should get the name and class of the element', () => {
      var actualResult = dom.getElementNameAndType('h1.foo');
      var expectedResult = {
        name: 'h1',
        class: 'foo'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });

    it('should get the name, id and class of the element', () => {
      var actualResult = dom.getElementNameAndType('h1#foo.bar');
      var expectedResult = {
        name: 'h1',
        id: 'foo',
        class: 'bar'
      };

      assert.deepEqual(actualResult, expectedResult, 'actualResult should match expectedResult');
    });
  });

  describe('#getElementType', () => {
    it('should be a function', () => {
      assert.typeOf(dom.getElementType, 'function', 'getElementType should be a function');
    });

    it('should get the type of a given element (id)', () => {
      var actualResult = dom.getElementType('#foo');
      var expectedResult = 'id';

      assert.strictEqual(actualResult, expectedResult, 'actualResult should be equal to expectedResult');
    });

    it('should get the type of a given element (class)', () => {
      var actualResult = dom.getElementType('.foo');
      var expectedResult = 'class';

      assert.strictEqual(actualResult, expectedResult, 'actualResult should be equal to expectedResult');
    });

    it('should get the type of a given element (tag)', () => {
      var actualResult = dom.getElementType('foo');
      var expectedResult = 'tag';

      assert.strictEqual(actualResult, expectedResult, 'actualResult should be equal to expectedResult');
    });
  });

  describe('#newElement', () => {
    it('should be a function', () => {
      assert.typeOf(dom.newElement, 'function', 'newElement should be a function');
    });

    it('should create a new element', () => {
      var createElementSpy = sinon.spy(document, 'createElement');
      var h1 = dom.newElement('h1');

      assert.isTrue(createElementSpy.called, 'document.createElementSpy was called');
    });
  });
});

{'fraction_non_alphanumeric': 0.15416451112260735, 'fraction_numerical': 0.002586652871184687, 'mean_word_length': 3.1822606814494323, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 47, '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': '5482167', 'n_tokens_mistral': 2168, 'n_tokens_neox': 2124, 'n_words': 563}