<commit_before>(function($) {
  /*
    ======== A Handy Little QUnit Reference ========
    http://api.qunitjs.com/

    Test methods:
      module(name, {[setup][ ,teardown]})
      test(name, callback)
      expect(numberOfAssertions)
      stop(increment)
      start(decrement)
    Test assertions:
      ok(value, [message])
      equal(actual, expected, [message])
      notEqual(actual, expected, [message])
      deepEqual(actual, expected, [message])
      notDeepEqual(actual, expected, [message])
      strictEqual(actual, expected, [message])
      notStrictEqual(actual, expected, [message])
      throws(block, [expected], [message])
  */

  module('jQuery#textnodes', {
    // This will run before each test in this module.
    setup: function() {
      this.elems = $('#qunit-fixture').children();
    }
  });

  test('is chainable', function() {
    expect(1);
    // Not a bad test to run on collection methods.
    strictEqual(this.elems.textnodes(), this.elems, 'should be chainable');
  });

  test('is awesome', function() {
    expect(1);
    strictEqual(this.elems.textnodes().text(), 'awesome0awesome1awesome2', 'should be awesome');
  });

  module('jQuery.textnodes');

  test('is awesome', function() {
    expect(2);
    strictEqual($.textnodes(), 'awesome.', 'should be awesome');
    strictEqual($.textnodes({punctuation: '!'}), 'awesome!', 'should be thoroughly awesome');
  });

  module(':textnodes selector', {
    // This will run before each test in this module.
    setup: function() {
      this.elems = $('#qunit-fixture').children();
    }
  });

  test('is awesome', function() {
    expect(1);
    // Use deepEqual & .get() when comparing jQuery objects.
    deepEqual(this.elems.filter(':textnodes').get(), this.elems.last().get(), 'knows awesome when it sees it');
  });
<commit_msg>Write tests.<commit_after>(function($) {
  /*
    ======== A Handy Little QUnit Reference ========
    http://api.qunitjs.com/

    Test methods:
      module(name, {[setup][ ,teardown]})
      test(name, callback)
      expect(numberOfAssertions)
      stop(increment)
      start(decrement)
    Test assertions:
      ok(value, [message])
      equal(actual, expected, [message])
      notEqual(actual, expected, [message])
      deepEqual(actual, expected, [message])
      notDeepEqual(actual, expected, [message])
      strictEqual(actual, expected, [message])
      notStrictEqual(actual, expected, [message])
      throws(block, [expected], [message])
  */

  var TEXT_NODE = 3;

  module('jQuery#textnodes', {
    // This will run before each test in this module.
    setup: function() {
      var fixture = $('#qunit-fixture');
      this.whitespaceOnly = fixture.find('.whitespaceOnly');
      this.deep = fixture.find('.deep');
      this.noTextNodes = fixture.find('.noTextNodes');
    }
  });

  test('gets only text nodes', function () {
    expect(1);

    var areAllTextNodes = true;

    this.allTextNodes.textnodes(true).each(function () {
      if (this.nodeType !== TEXT_NODE) {
        areAllTextNodes = false;
      }
    });

    ok(areAllTextNodes, 'should only return text nodes');
  }

  test('gets the right number of nodes', function() {
    expect(6);

    strictEqual(this.whitespaceOnly.textnodes(), 0, 'ignores whitespace-only text nodes by default');
    strictEqual(this.whitespaceOnly.textnodes(true), 3, 'does not ignore whitespace-only text nodes if told to');

    strictEqual(this.deep.textnodes(), 5, 'gets all descendent text nodes, except whitespace-only ones');
    strictEqual(this.deep.textnodes(true), 7, 'gets all descendent text nodes, including whitespace-only ones if told to');

    strictEqual(this.noTextNodes.textnodes(), 0, 'returns an empty jQuery object when there are no text nodes');
    strictEqual(this.noTextNodes.textnodes(true), 0, 'returns an empty jQuery object when there are no text nodes, not even whitespace-only ones');
  });

{'fraction_non_alphanumeric': 0.15439490445859871, 'fraction_numerical': 0.004076433121019108, 'mean_word_length': 3.45124716553288, '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': '200901', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1158, 'n_words': 301}