<commit_before>import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon-sandbox';

import DateInput from '../../src/components/DateInput';

const event = { preventDefault() {}, stopPropagation() {} };

describe('DateInput', () => {
  describe('#render', () => {
    describe('input', () => {
      it('has props.ariaLabel as an aria-label if prop is passed in', () => {
        const ariaLabel = 'ariaLabelExample';
        const wrapper = shallow(<DateInput id="date" ariaLabel={ariaLabel} />).dive();
        expect(wrapper.find('input').props()['aria-label']).to.equal(ariaLabel);
      });

      it('has no aria-label if props.ariaLabel is null', () => {
        const wrapper = shallow(<DateInput id="date" ariaLabel={null} />).dive();
        expect(wrapper.find('input').props()['aria-label']).to.equal(null);
      });

      it('has props.ariaLabel as an aria-label if prop is passed in', () => {
        const placeholder = 'placeholder foo';
        const wrapper = shallow(<DateInput id="date" placeholder={placeholder} />).dive();
        expect(wrapper.find('input').props()['aria-label']).to.equal(placeholder);
      });

      it('has value === props.displayValue', () => {
        const DISPLAY_VALUE = 'foobar';
        const wrapper = shallow(<DateInput id="date" displayValue={DISPLAY_VALUE} />).dive();
        expect(wrapper.find('input').props().value).to.equal(DISPLAY_VALUE);
      });

      it('has value === state.dateString if displayValue is not passed in', () => {
        const DATE_STRING = 'foobar';
        const wrapper = shallow(<DateInput id="date" />).dive();
        wrapper.setState({
          dateString: DATE_STRING,
        });
        expect(wrapper.find('input').props().value).to.equal(DATE_STRING);
      });

      it('props.displayValue overrides dateString when not null', () => {
        const DATE_STRING = 'foobar';<commit_msg>fixing test description<commit_after>import React from 'react';
import { expect } from 'chai';
import { shallow } from 'enzyme';
import sinon from 'sinon-sandbox';

import DateInput from '../../src/components/DateInput';

const event = { preventDefault() {}, stopPropagation() {} };

describe('DateInput', () => {
  describe('#render', () => {
    describe('input', () => {
      it('has props.ariaLabel as an aria-label if ariaLabel is passed in', () => {
        const ariaLabel = 'ariaLabelExample';
        const wrapper = shallow(<DateInput id="date" ariaLabel={ariaLabel} />).dive();
        expect(wrapper.find('input').props()['aria-label']).to.equal(ariaLabel);
      });

      it('has no aria-label if props.ariaLabel is null', () => {
        const wrapper = shallow(<DateInput id="date" ariaLabel={null} />).dive();
        expect(wrapper.find('input').props()['aria-label']).to.equal(null);
      });

      it('has props.placeholder as an aria-label if ariaLabel is not passed in', () => {
        const placeholder = 'placeholder foo';
        const wrapper = shallow(<DateInput id="date" placeholder={placeholder} />).dive();
        expect(wrapper.find('input').props()['aria-label']).to.equal(placeholder);
      });

      it('has value === props.displayValue', () => {
        const DISPLAY_VALUE = 'foobar';
        const wrapper = shallow(<DateInput id="date" displayValue={DISPLAY_VALUE} />).dive();
        expect(wrapper.find('input').props().value).to.equal(DISPLAY_VALUE);
      });

      it('has value === state.dateString if displayValue is not passed in', () => {
        const DATE_STRING = 'foobar';
        const wrapper = shallow(<DateInput id="date" />).dive();
        wrapper.setState({
          dateString: DATE_STRING,
        });
        expect(wrapper.find('input').props().value).to.equal(DATE_STRING);
      });

      it('props.displayValue overrides dateString when not null', () => {
        const DATE_STRING = 'foobar';
{'fraction_non_alphanumeric': 0.18037812979049567, 'fraction_numerical': 0.0, 'mean_word_length': 3.255434782608696, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 31, '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': '3933599', 'n_tokens_mistral': 1130, 'n_tokens_neox': 1097, 'n_words': 252}