<commit_before>/** @jsx React.DOM */

var InputView = require('../code/views/inputView.jsx');

describe('InputComponent', function() {

  it('should render text input', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input');
    assert.isDefined(renderedInput);

  });

  it('should render password input', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="password" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input');
    assert.isDefined(renderedInput);

  });

  it('should render email input', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="email" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input');
    assert.isDefined(renderedInput);

  });

  it('should render input with label', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" label="<NAME>" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'input-group-label');
    assert.isDefined(renderedInput);

  });

  it('should render input as disabled', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" disabled />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
    assert.equal(renderedInput.getDOMNode().getAttribute('disabled'), '');

  });

  it('should render input as readonly', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" readOnly />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
    assert.equal(renderedInput.getDOMNode().getAttribute('readonly'), '');

  });

});

describe('InputComponent Error without Message', function() {
  var input, renderedInput, val;
  var email_validator = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

  beforeEach(function(){

    input = TestUtils.renderIntoDocument(
      <InputView type="text" validator={email_validator} />
    );

    renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
  });

  it('should change the value to be invalid and throw error state with null message', function() {
    TestUtils.Simulate.change(renderedInput.getDOMNode(), { target: { value: 'invalid @ email . #$%' }});
    assert.equal(input.state.unitTestError, null);
  });
});

describe('InputComponent Error with Custom Message', function() {
  var input, renderedInput, val;
  var email_validator = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  var email_error_message = 'Invalid Email';

  beforeEach(function(){

    input = TestUtils.renderIntoDocument(
      <InputView type="text" validator={email_validator} errorMessage={email_error_message} />
    );
    renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
  });

  it('should change the value to be invalid and throw error state with custom message', function() {
    TestUtils.Simulate.change(renderedInput.getDOMNode(), { target: { value: 'invalid @ email . #$%' }});
    assert.equal(input.state.unitTestError, email_error_message);
  });
});<commit_msg>fixed linting on Unit Tests<commit_after>/** @jsx React.DOM */

var InputView = require('../code/views/inputView.jsx');

describe('InputComponent', function() {

  it('should render text input', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input');
    assert.isDefined(renderedInput);

  });

  it('should render password input', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="password" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input');
    assert.isDefined(renderedInput);

  });

  it('should render email input', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="email" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input');
    assert.isDefined(renderedInput);

  });

  it('should render input with label', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" label="<NAME>" />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'input-group-label');
    assert.isDefined(renderedInput);

  });

  it('should render input as disabled', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" disabled />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
    assert.equal(renderedInput.getDOMNode().getAttribute('disabled'), '');

  });

  it('should render input as readonly', function() {
    var input = TestUtils.renderIntoDocument(
      <InputView type="text" readOnly />
    );

    var renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
    assert.equal(renderedInput.getDOMNode().getAttribute('readonly'), '');

  });

});

describe('InputComponent Error without Message', function() {
  var input, renderedInput;
  var emailValidator = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

  beforeEach(function(){

    input = TestUtils.renderIntoDocument(
      <InputView type="text" validator={emailValidator} />
    );

    renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
  });

  it('should change the value to be invalid and throw error state with null message', function() {
    TestUtils.Simulate.change(renderedInput.getDOMNode(), { target: { value: 'invalid @ email . #$%' }});
    assert.equal(input.state.unitTestError, null);
  });
});

describe('InputComponent Error with Custom Message', function() {
  var input, renderedInput;
  var emailValidator = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  var emailErrorMessage = 'Invalid Email';

  beforeEach(function(){

    input = TestUtils.renderIntoDocument(
      <InputView type="text" validator={emailValidator} errorMessage={emailErrorMessage} />
    );
    renderedInput = TestUtils.findRenderedDOMComponentWithClass(input, 'component-input-field');
  });

  it('should change the value to be invalid and throw error state with custom message', function() {
    TestUtils.Simulate.change(renderedInput.getDOMNode(), { target: { value: 'invalid @ email . #$%' }});
    assert.equal(input.state.unitTestError, emailErrorMessage);
  });
});
{'fraction_non_alphanumeric': 0.16710031801098582, 'fraction_numerical': 0.003469210754553339, 'mean_word_length': 4.3428571428571425, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '6335701', 'n_tokens_mistral': 2115, 'n_tokens_neox': 2044, 'n_words': 394}