<commit_before>var StartView = require('../../../../../../javascripts/cartodb/common/dialogs/change_privacy/start_view');
var cdbAdmin = require('cdb.admin');
var $ = require('jquery');
var _ = require('underscore');
var PrivacyOptions = require('../../../../../../javascripts/cartodb/common/dialogs/change_privacy/options_collection');

/**
 * Most high-fidelity details are covered in underlying collection/model, so no need to re-test that here.
 * The importat feature is the interactions and that view don't throw errors on render and updates.
 */
describe('common/dialogs/change_privacy/start_view', function() {
  beforeEach(function() {
    this.user = new cdbAdmin.User({
      username: 'pepe',
      actions: {
        private_tables: true,
        private_maps: true
      }
    });

    this.vis = new cdbAdmin.Visualization({
      type: 'derived',
      privacy: 'PUBLIC'
    });

    this.createView = function() {
      this.view && this.view.clean();
      this.privacyOptions = PrivacyOptions.byVisAndUser(this.vis, this.user);
      this.view = new StartView({
        vis: this.vis,
        user: this.user,
        privacyOptions: this.privacyOptions
      });
      spyOn(this.view, 'killEvent');

      this.view.render();
    };

    this.createView();
  });

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

  it('should have the first (public) option is selected by default', function() {
    expect(this.innerHTML()).toMatch('is-selected.+data-index="0"');
  });

  it('should not render the upgrade banner by default', function() {
    expect(this.innerHTML()).not.toContain('upgrade');
  });

  it('should not render the password input', function() {
    expect(this.innerHTML()).not.toContain('<input');
  });

  it('should not disable the save button', function() {
    expect(this.innerHTML()).not.toContain('is-disabled');<commit_msg>Fixes spec<commit_after>var StartView = require('../../../../../../javascripts/cartodb/common/dialogs/change_privacy/start_view');
var cdbAdmin = require('cdb.admin');
var $ = require('jquery');
var _ = require('underscore');
var PrivacyOptions = require('../../../../../../javascripts/cartodb/common/dialogs/change_privacy/options_collection');

/**
 * Most high-fidelity details are covered in underlying collection/model, so no need to re-test that here.
 * The importat feature is the interactions and that view don't throw errors on render and updates.
 */
describe('common/dialogs/change_privacy/start_view', function() {
  beforeEach(function() {
    this.user = new cdbAdmin.User({
      username: 'pepe',
      actions: {
        private_tables: true,
        private_maps: true
      }
    });

    this.vis = new cdbAdmin.Visualization({
      type: 'derived',
      privacy: 'PUBLIC'
    });

    this.createView = function() {
      this.view && this.view.clean();
      this.privacyOptions = PrivacyOptions.byVisAndUser(this.vis, this.user);
      this.view = new StartView({
        vis: this.vis,
        user: this.user,
        privacyOptions: this.privacyOptions
      });
      spyOn(this.view, 'killEvent');

      this.view.render();
    };

    this.createView();
  });

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

  it('should have the first (public) option is selected by default', function() {
    expect(this.innerHTML()).toMatch('is-selected.+data-index="0"');
  });

  it('should not render the upgrade banner by default', function() {
    expect(this.innerHTML()).not.toContain('upgrade');
  });

  it('should render the password input', function() {
    expect(this.innerHTML()).toContain('<input');
  });

  it('should not disable the save button', function() {
    expect(this.innerHTML()).not.toContain('is-disabled');
{'fraction_non_alphanumeric': 0.16381803839074416, 'fraction_numerical': 0.0005259006047856955, 'mean_word_length': 3.2645739910313902, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3636240', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1103, 'n_words': 255}