<commit_before>var InfoboxView = require('../../../../../javascripts/cartodb3/components/infobox/infobox-item-view');

describe('components/infobox/infobox-item-view', function () {
  var view;

  beforeEach(function () {
    view = new InfoboxView({
      type: 'error',
      title: 'Info',
      body: 'Lorem ipsum dolor sit amet.',
      mainAction: {
        label: 'Cancel'
      },
      secondAction: {
        label: 'Proceed'
      }
    });

    view.render();
  });

  it('should render properly', function () {
    expect(view.$('h2').text()).toBe('Info');
    expect(view.$('div').text()).toContain('Lorem ipsum');
    expect(view.$('button').length).toBe(2);
    expect(view.$('button').eq(0).text()).toContain('Cancel');
    expect(view.$('button').eq(1).text()).toContain('Proceed');
  });

  it('should trigger events properly', function () {
    var callback = {
      main: function () {},
      second: function () {}<commit_msg>Added some generic tests for infobox item<commit_after>var InfoboxView = require('../../../../../javascripts/cartodb3/components/infobox/infobox-item-view');

describe('components/infobox/infobox-item-view', function () {
  var view;

  beforeEach(function () {
    view = new InfoboxView({
      type: 'error',
      title: 'Info',
      body: 'Lorem ipsum dolor sit amet.',
      mainAction: {
        label: 'Cancel'
      },
      secondAction: {
        label: 'Proceed'
      }
    });

    view.render();
  });

  it('should render properly', function () {
    expect(view.$('h2').text()).toBe('Info');
    expect(view.$('div').text()).toContain('Lorem ipsum');
    expect(view.$('button').length).toBe(2);
    expect(view.$('button').eq(0).text()).toContain('Cancel');
    expect(view.$('button').eq(1).text()).toContain('Proceed');
  });

  it('should render loading when it is defined', function () {
    var v = new InfoboxView({
      type: 'alert',
      title: 'Info',
      body: 'Lorem ipsum dolor sit amet.',
      loading: true
    });

    v.render();
    expect(v.$('.CDB-LoaderIcon').length).toBe(1);
  });

  it('should render quota when needed', function () {
    var v = new InfoboxView({
      type: 'alert',
      title: 'Info',
      body: 'Lorem ipsum dolor sit amet.',
      quota: {
        usedQuota: 10,
        totalQuota: 100
      },
      secondAction: {
        label: 'Proceed'
      }
    });

    v.render();
    expect(v.$('.js-quota').length).toBe(1);
    expect(v.$('.Infobox-quotaBar').length).toBe(1);
  });

  it('should trigger events properly', function () {
    var callback = {
      main: function () {},
      second: function () {}
{'fraction_non_alphanumeric': 0.20083523158694003, 'fraction_numerical': 0.00683371298405467, 'mean_word_length': 2.7060478199718707, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6891450', 'n_tokens_mistral': 863, 'n_tokens_neox': 824, 'n_words': 161}