<commit_before>describe('Component', function () {
  'use strict';
  var Component = Backbone.React.Component.extend({
    render: function () {
      return React.DOM.div({}, this.props.test);
    }
  });
  var component, model1, model2, collection1, collection2;
  beforeEach(function () {
    model1 = new Backbone.Model({test: 'A'});
    model2 = new Backbone.Model({otherTest: 'B'});
    collection1 = new Backbone.Collection([model1, model2]);
    collection2 = new Backbone.Collection([model2, model1]);
  });
  afterEach(function () {
    if (component) component.remove();
    component = void 0;
    model1.stopListening();
    model2.stopListening();
    collection1.stopListening();
    collection2.stopListening();
  });
  it('mounts and renders', function () {
    component = new Component({
      model: model1,
      el: document.createElement('div')
    }).mount();
    expect(component.el.childNodes.length).toEqual(1);
    expect(component.el.textContent).toEqual('A');
  });
  it('unmounts', function () {
    component = new Component({el: document.createElement('div')});
    component.mount();
    component.unmount();
    expect(component.el.childNodes.length).toEqual(0);
  });
  it('gets the model(s)', function () {
    component = new Component({model: model1});
    expect(component.getModel()).toEqual(model1);
  });
  it('gets the collection(s)', function () {
    component = new Component({collection: collection1});
    expect(component.getCollection()).toEqual(collection1);
  });
  it('is clonable', function () {
    component = new Component({model: model1});
    var clone = component.clone({model: model2});
    expect(clone).toBeDefined();
    expect(clone.getModel()).toEqual(model2);
    clone.remove();
  });
  it('binds to a model', function () {
    component = new Component({model: model1});
    expect(component.props.test).toEqual('A');
    model1.set('test', 'B');
    expect(component.props.test).toEqual('B');
  });
  it('binds to multiple models', function () {
    component = new Component({
      model: {
        model1: model1,
        model2: model2
      }
    });
    expect(component.props.model1.test).toEqual('A');
    expect(component.props.model2.otherTest).toEqual('B');
  });<commit_msg>extend test<commit_after>describe('Component', function () {
  'use strict';
  var Component = Backbone.React.Component.extend({
    render: function () {
      return React.DOM.div({}, this.props.test);
    }
  });
  var component, model1, model2, collection1, collection2;
  beforeEach(function () {
    model1 = new Backbone.Model({test: 'A'});
    model2 = new Backbone.Model({otherTest: 'B'});
    collection1 = new Backbone.Collection([model1, model2]);
    collection2 = new Backbone.Collection([model2, model1]);
  });
  afterEach(function () {
    if (component) component.remove();
    component = void 0;
    model1.stopListening();
    model2.stopListening();
    collection1.stopListening();
    collection2.stopListening();
  });
  it('mounts and renders', function () {
    component = new Component({
      model: model1,
      el: document.createElement('div')
    }).mount();
    expect(component.el.childNodes.length).toEqual(1);
    expect(component.el.textContent).toEqual('A');
  });
  it('unmounts', function () {
    component = new Component({el: document.createElement('div')});
    component.mount();
    component.unmount();
    expect(component.el.childNodes.length).toEqual(0);
  });
  it('gets the model(s)', function () {
    component = new Component({model: model1});
    expect(component.getModel()).toEqual(model1);
  });
  it('gets the collection(s)', function () {
    component = new Component({collection: collection1});
    expect(component.getCollection()).toEqual(collection1);
  });
  it('is clonable', function () {
    component = new Component({model: model1});
    var clone = component.clone({model: model2});
    expect(clone).toBeDefined();
    expect(clone.getModel()).toEqual(model2);
    clone.remove();
  });
  it('allows extending', function () {
    var NewComponent = Component.extend({
      test: function () {}
    });
    expect(NewComponent).toBeDefined();
    var newComponent = new NewComponent({el: document.createElement('div')}).mount();
    expect(newComponent.test).toBeDefined();
  });
  it('binds to a model', function () {
    component = new Component({model: model1});
    expect(component.props.test).toEqual('A');
    model1.set('test', 'B');
    expect(component.props.test).toEqual('B');
  });
  it('binds to multiple models', function () {
    component = new Component({
      model: {
        model1: model1,
        model2: model2
      }
    });
    expect(component.props.model1.test).toEqual('A');
    expect(component.props.model2.otherTest).toEqual('B');
  });
{'fraction_non_alphanumeric': 0.17315296566077004, 'fraction_numerical': 0.014568158168574402, 'mean_word_length': 3.782089552238806, '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': '480216', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1438, 'n_words': 274}