<commit_before>import Ember from 'ember';
import startApp from '../helpers/start-app';
import { test, module } from 'qunit';

var application;

const ADD_BUTTON = 'button.add';
const SAVE_BUTTON = 'button.save';
const REMOVE_LAST_BUTTON = 'button.remove:eq(3)';

const FIRST_NAME_ERROR_FIELD = '.name-parent-div:eq(0) span';
const FIRST_NAME_INPUT = '.name-parent-div:eq(0) input';

const SECOND_NAME_ERROR_FIELD = '.name-parent-div:eq(1) span';
const SECOND_NAME_INPUT = '.name-parent-div:eq(1) input';

const THIRD_NAME_ERROR_FIELD = '.name-parent-div:eq(2) span';
const THIRD_NAME_INPUT = '.name-parent-div:eq(2) input';

const FOURTH_NAME_ERROR_FIELD = '.name-parent-div:eq(3) span';
const FOURTH_NAME_INPUT = '.name-parent-div:eq(3) input';

module('Acceptance: Multi Starting Empty Validation', {
  setup: function() {
    application = startApp();
  },
  teardown: function() {
    Ember.run(application, 'destroy');
  }
});

test('clicking save will not transition to success when only the last field is valid', function(assert) {
  visit('/multi-starting-empty');
  click(ADD_BUTTON);
  click(ADD_BUTTON);
  fillIn(FIRST_NAME_INPUT, 'toran');
  fillIn(SECOND_NAME_INPUT, 'brandon');
  andThen(function() {
    assert.equal(find(FIRST_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(SECOND_NAME_ERROR_FIELD).hasClass('hidden'), true);
  });
  click(ADD_BUTTON);
  andThen(function() {
    assert.equal(find(FIRST_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(SECOND_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(THIRD_NAME_ERROR_FIELD).hasClass('hidden'), true);
  });
  fillIn(THIRD_NAME_INPUT, 'toran');
  andThen(function() {
    assert.equal(find(FIRST_NAME_ERROR_FIELD).hasClass('hidden'), false);
    assert.equal(find(SECOND_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(THIRD_NAME_ERROR_FIELD).hasClass('hidden'), false);
  });<commit_msg>[TESTS]: updated the new starting empty test name<commit_after>import Ember from 'ember';
import startApp from '../helpers/start-app';
import { test, module } from 'qunit';

var application;

const ADD_BUTTON = 'button.add';
const SAVE_BUTTON = 'button.save';
const REMOVE_LAST_BUTTON = 'button.remove:eq(3)';

const FIRST_NAME_ERROR_FIELD = '.name-parent-div:eq(0) span';
const FIRST_NAME_INPUT = '.name-parent-div:eq(0) input';

const SECOND_NAME_ERROR_FIELD = '.name-parent-div:eq(1) span';
const SECOND_NAME_INPUT = '.name-parent-div:eq(1) input';

const THIRD_NAME_ERROR_FIELD = '.name-parent-div:eq(2) span';
const THIRD_NAME_INPUT = '.name-parent-div:eq(2) input';

const FOURTH_NAME_ERROR_FIELD = '.name-parent-div:eq(3) span';
const FOURTH_NAME_INPUT = '.name-parent-div:eq(3) input';

module('Acceptance: Multi Starting Empty Validation', {
  setup: function() {
    application = startApp();
  },
  teardown: function() {
    Ember.run(application, 'destroy');
  }
});

test('unique name validation will fire for newly added models and when a model is removed', function(assert) {
  visit('/multi-starting-empty');
  click(ADD_BUTTON);
  click(ADD_BUTTON);
  fillIn(FIRST_NAME_INPUT, 'toran');
  fillIn(SECOND_NAME_INPUT, 'brandon');
  andThen(function() {
    assert.equal(find(FIRST_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(SECOND_NAME_ERROR_FIELD).hasClass('hidden'), true);
  });
  click(ADD_BUTTON);
  andThen(function() {
    assert.equal(find(FIRST_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(SECOND_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(THIRD_NAME_ERROR_FIELD).hasClass('hidden'), true);
  });
  fillIn(THIRD_NAME_INPUT, 'toran');
  andThen(function() {
    assert.equal(find(FIRST_NAME_ERROR_FIELD).hasClass('hidden'), false);
    assert.equal(find(SECOND_NAME_ERROR_FIELD).hasClass('hidden'), true);
    assert.equal(find(THIRD_NAME_ERROR_FIELD).hasClass('hidden'), false);
  });
{'fraction_non_alphanumeric': 0.15862068965517243, 'fraction_numerical': 0.004597701149425287, 'mean_word_length': 6.055855855855856, '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': '3629553', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1345, 'n_words': 234}