// don"t mock our CUT or components it depends on
jest.dontMock("../src/components/MenuItem");

import React from "react";
import ReactDOM from "react-dom";
import TestUtils from "react-addons-test-utils";

// TODO: move this to es6 style import when its implemented in jest
const MenuItem = require("../src/components/MenuItem").default;


describe("MenuItem", () => {
  it("Renders a MenuItem", () => {
    const text = "howdy";

    // Render a MenuItem with no style
    const menuItem = TestUtils.renderIntoDocument(
        <MenuItem text= {text} />
    );
    // grab the DOM node so we can inspect it
    const menuItemNode = ReactDOM.findDOMNode(menuItem);

    // Verify that it"s rendered with the right text
    expect(menuItemNode.textContent).toEqual(text);

  });

});

// don"t mock our CUT or components it depends on
jest.dontMock("../src/components/MenuItem");

import React from "react";
import ReactDOM from "react-dom";
import TestUtils from "react-addons-test-utils";

// TODO: move this to es6 style import when its implemented in jest
const MenuItem = require("../src/components/MenuItem").default;


describe("MenuItem", () => {
  it("Does render a MenuItem", () => {
    const text = "howdy";

    // Render a MenuItem with no style
    const menuItem = TestUtils.renderIntoDocument(
        <MenuItem text= {text} />
    );
    // grab the DOM node so we can inspect it
    const menuItemNode = ReactDOM.findDOMNode(menuItem);

    // Verify that it"s rendered with the right text
    expect(menuItemNode.textContent).toEqual(text);

  });

  it("Does trigger an event when clicked", (done) => {
    function clickEvent() {
      done();
    }

    const menuItem = TestUtils.renderIntoDocument(
        <MenuItem handleClick={clickEvent} />
    );

    const menuItemNode = ReactDOM.findDOMNode(menuItem);

    TestUtils.Simulate.click(menuItemNode);
  });

});

Test to ensure that click events are fired for Menu items
Test to ensure that click events are fired for Menu items
