<commit_before>var AnalysisOptionModel = require('../../../../../../javascripts/cartodb3/components/modals/add-analysis/analysis-option-models/analysis-option-model');
var AnalysisOptionView = require('../../../../../../javascripts/cartodb3/components/modals/add-analysis/analysis-option-view');

describe('components/modals/add-analysis/analysis-option-view', function () {
  beforeEach(function () {
    this.model = new AnalysisOptionModel({
      title: 'Buffer',
      desc: 'describes the buffer type',
      type_group: 'area of influence'
    }, {
      nodeAttrs: {
        type: 'buffer'
      }
    });
  });

  describe('when given a simple geometry type', function () {
    beforeEach(function () {
      this.view = new AnalysisOptionView({
        model: this.model,
        simpleGeometryTypeInput: 'point'
      });
      this.view.render();
    });

    it('should not have any leaks', function () {
      expect(this.view).toHaveNoLeaks();
    });

    it('should render the info', function () {
      expect(this.view.$el.html()).toContain('Buffer');
      expect(this.view.$el.html()).toContain('describes the buffer');
    });

    it('should render the info link', function () {
      expect(this.view.$('.js-more').length).toBe(1);
    });

    it('should render the animation', function () {
      console.log(this.view.$el.html());
      expect(this.view.$('.js-animation').length).toBe(1);
    });

    describe('when selected', function () {
      beforeEach(function () {
        this.model.set('selected', true);
      });
<commit_msg>Adds spec<commit_after>var AnalysisOptionModel = require('../../../../../../javascripts/cartodb3/components/modals/add-analysis/analysis-option-models/analysis-option-model');
var AnalysisOptionView = require('../../../../../../javascripts/cartodb3/components/modals/add-analysis/analysis-option-view');

describe('components/modals/add-analysis/analysis-option-view', function () {
  beforeEach(function () {
    this.model = new AnalysisOptionModel({
      title: 'Buffer',
      desc: 'describes the buffer type',
      type_group: 'area of influence'
    }, {
      nodeAttrs: {
        type: 'buffer'
      }
    });
  });

  describe('when given a simple geometry type', function () {
    beforeEach(function () {
      this.view = new AnalysisOptionView({
        model: this.model,
        simpleGeometryTypeInput: 'point'
      });
      this.view.render();
    });

    it('should not have any leaks', function () {
      expect(this.view).toHaveNoLeaks();
    });

    it('should render the info', function () {
      expect(this.view.$el.html()).toContain('Buffer');
      expect(this.view.$el.html()).toContain('describes the buffer');
    });

    it('should render the info link and trigger the info event', function () {
      var clicked = false;

      expect(this.view.$('.js-more').length).toBe(1);

      this.view.bind('onClickInfo', function () {
        clicked = true;
      }, this);

      this.view.$('.js-more').click();

      expect(clicked).toBeTruthy();
      expect(this.model.get('selected')).toBeTruthy();
    });

    it('should render the animation', function () {
      console.log(this.view.$el.html());
      expect(this.view.$('.js-animation').length).toBe(1);
    });

    describe('when selected', function () {
      beforeEach(function () {
        this.model.set('selected', true);
      });

{'fraction_non_alphanumeric': 0.18331374853113983, 'fraction_numerical': 0.0023501762632197414, 'mean_word_length': 2.8087248322147653, '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': '5664562', 'n_tokens_mistral': 995, 'n_tokens_neox': 972, 'n_words': 173}