<commit_before>jest.dontMock("moment");
import React from "react/addons";
jest.dontMock("../DateTimeField.js");
const { TestUtils } = React.addons;

describe("DateTimeField", function() {
  const moment = require("moment");
  const DateTimeField = require("../DateTimeField.js");
  let parent, TestParent;

  beforeEach(() => {
    TestParent = React.createFactory(React.createClass({
      getInitialState() {
        return { dateTime: moment("1990-06-05 07:30").format("x") };
      },

      render() {
        return <DateTimeField dateTime={this.state.dateTime} />;
      }
    }));
    parent = TestUtils.renderIntoDocument(TestParent()); // eslint-disable-line
  });

  describe("By default", function() {

   it("shows the right date for a given dateTime and inputFormat", function() {
     const input = TestUtils.findRenderedDOMComponentWithTag(parent, "input");
     expect(input.getDOMNode().value).toBe("06/05/90 7:30 AM");
    });

  });

  describe("When changing props", function() {

   it("changes the displayed date when dateTime changes", function() {
     const input = TestUtils.findRenderedDOMComponentWithTag(parent, "input");
     expect(input.getDOMNode().value).toBe("06/05/90 7:30 AM");
     parent.setState({dateTime: moment("1981-06-04 05:45").format("x")});
     expect(input.getDOMNode().value).toBe("06/04/81 5:45 AM");
    });

  });
});<commit_msg>Adds test for when changing inputFormat prop<commit_after>jest.dontMock("moment");
import React from "react/addons";
jest.dontMock("../DateTimeField.js");
const { TestUtils } = React.addons;

describe("DateTimeField", function() {
  const moment = require("moment");
  const DateTimeField = require("../DateTimeField.js");
  const happyDate = moment("1990-06-05 07:30");
  let parent, TestParent;

  beforeEach(() => {
    TestParent = React.createFactory(React.createClass({
      getInitialState() {
        return { dateTime: happyDate.format("x") };
      },

      render() {
        return <DateTimeField {...this.state} />;
      }
    }));
    parent = TestUtils.renderIntoDocument(TestParent()); // eslint-disable-line
  });

  describe("By default", function() {

   it("shows the right date for a given dateTime and inputFormat", function() {
     const input = TestUtils.findRenderedDOMComponentWithTag(parent, "input");
     expect(input.getDOMNode().value).toBe("06/05/90 7:30 AM");
    });

  });

  describe("When changing props", function() {

   it("changes the displayed date when dateTime changes", function() {
     const input = TestUtils.findRenderedDOMComponentWithTag(parent, "input");
     expect(input.getDOMNode().value).toBe("06/05/90 7:30 AM");
     parent.setState({dateTime: moment("1981-06-04 05:45").format("x")});
     expect(input.getDOMNode().value).toBe("06/04/81 5:45 AM");
    });

   it("changes the displayed format when inputFormat changes", function() {
     const input = TestUtils.findRenderedDOMComponentWithTag(parent, "input");
     expect(input.getDOMNode().value).toBe("06/05/90 7:30 AM");
     parent.setState({inputFormat: "x"});
     expect(input.getDOMNode().value).toBe(happyDate.format("x"));
    });

  });
});
{'fraction_non_alphanumeric': 0.1713197969543147, 'fraction_numerical': 0.03521573604060914, 'mean_word_length': 3.9653543307086614, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '6183561', 'n_tokens_mistral': 1025, 'n_tokens_neox': 939, 'n_words': 189}