<commit_before>describe('An item', function () {
  var items = require('../../main/js/Item.js');
  var Item = items.Item;
  beforeEach(function () {
    jasmine.addCustomEqualityTester(items.equality);
  });

  it('should have a working equality method', function () {
    var item1 = new Item('something');
    var item2 = new Item('something');
    expect(item1).toEqual(item2);
  });

  it('should have custom click handlers', function () {
    var myItem = new Item('something');
    var clickText = 'click something';
    myItem.on('click', function () {
      return clickText;
    });
    var ret = myItem.click();
    expect(ret).toEqual(clickText);
  });

  it('may be used with other items in both directions', function () {
    var paper = new Item('paper');
    var pen = new Item('pen');
    var text = new Item('text');
    paper.on('use', {
      pen : function () {
        return text;
      }
    });

    expect(paper.use(pen)).toEqual(text);
    expect(pen.use(paper)).toEqual(text);
  });

  it('should not be possible to have different usages', function () {
    var paper = new Item('paper');
    var pen = new Item('pen');
    var text = new Item('text');
    paper.on('use', {
      pen : function () {
        return text;
      }
    });
    expect(function () {
      pen.on('use', {
        paper : function () {
          return pen;
        }
      });
    }).toThrow();
  });

  it('should be possible to return multiple items on usage', function () {
    var paper = new Item('paper');
    var pen = new Item('pen');
    var text = new Item('text');
    paper.on('use', {
      pen : function () {
        return [pen, text];
      }
    });
    expect(paper.use(pen)).toEqual([pen, text]);
  });

  it('should be possible to highlight items', function () {
    var $element = document.createElement('div');
    var something = new Item('something', $element);

    something.highlight();
    expect($element.classList.contains('highlight')).toBe(true);
  })
});<commit_msg>Small text fix and code style<commit_after>describe('An item', function () {
  var items = require('../../main/js/Item.js');
  var Item = items.Item;

  beforeEach(function () {
    jasmine.addCustomEqualityTester(items.equality);
  });

  it('should have a working equality method', function () {
    var item1 = new Item('something');
    var item2 = new Item('something');
    expect(item1).toEqual(item2);
  });

  it('should have custom click handlers', function () {
    var myItem = new Item('something');
    var clickText = 'click something';
    myItem.on('click', function () {
      return clickText;
    });
    var ret = myItem.click();
    expect(ret).toEqual(clickText);
  });

  it('may be used with other items in both directions', function () {
    var paper = new Item('paper');
    var pen = new Item('pen');
    var text = new Item('text');
    paper.on('use', {
      pen : function () {
        return text;
      }
    });

    expect(paper.use(pen)).toEqual(text);
    expect(pen.use(paper)).toEqual(text);
  });

  it('should not be possible to have different usages with the same items', function () {
    var paper = new Item('paper');
    var pen = new Item('pen');
    var text = new Item('text');
    paper.on('use', {
      pen : function () {
        return text;
      }
    });
    expect(function () {
      pen.on('use', {
        paper : function () {
          return pen;
        }
      });
    }).toThrow();
  });

  it('should be possible to return multiple items on usage', function () {
    var paper = new Item('paper');
    var pen = new Item('pen');
    var text = new Item('text');
    paper.on('use', {
      pen : function () {
        return [pen, text];
      }
    });
    expect(paper.use(pen)).toEqual([pen, text]);
  });

  it('should be possible to highlight items', function () {
    var $element = document.createElement('div');
    var something = new Item('something', $element);

    something.highlight();
    expect($element.classList.contains('highlight')).toBe(true);
  });

});
{'fraction_non_alphanumeric': 0.1695040710584752, 'fraction_numerical': 0.0019738465334320256, 'mean_word_length': 2.7124542124542126, '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': '2724431', 'n_tokens_mistral': 1204, 'n_tokens_neox': 1190, 'n_words': 325}