controls popup tests

pull/351/head
MrChristofferson 2017-07-24 14:33:06 -05:00
parent ed6b2acde0
commit 5850ed6d48
2 changed files with 20 additions and 17 deletions

View File

@ -1,23 +1,26 @@
import * as React from "react";
import { ControlsPopup } from "../controls_popup";
import { render } from "enzyme";
import { mount } from "enzyme";
import { State } from "../controls_popup";
import { DirectionButton } from "../controls/direction_button";
describe("<ControlsPopup />", () => {
let wrapper = mount(<ControlsPopup dispatch={jest.fn()} />);
let button = mount(<DirectionButton
axis="x"
direction="left"
isInverted={false}
steps={1000}
/>);
// let popup = render(<ControlsPopup dispatch={}/>);
// let container = popup.find("controls-popupp");
it("Has a false initial state", () => {
expect(wrapper.state("isOpen")).toBeFalsy();
});
// it("Has correct amount of children elements", () => {
// let divs = popup.find("div");
// expect(divs.length).toEqual(1);
// });
// it("Has correct classname", () => {
// expect(container).toBeTruthy();
// });
// it("Has public render", () => {
// expect(popup).toHaveProperty("render");
// });
it("Toggles state", () => {
let parent = wrapper.find("div").first();
parent.simulate("click");
expect(wrapper.state("isOpen")).toBeTruthy();
});
});

View File

@ -3,12 +3,12 @@ import { connect } from "react-redux";
import { DirectionButton } from "./controls/direction_button";
interface State {
export interface State {
isOpen: boolean;
stepSize: number;
}
interface Props {
export interface Props {
dispatch: Function;
}