Farmbot-Web-App/webpack/nav/__tests__/nav_index_test.tsx

39 lines
1 KiB
TypeScript
Raw Normal View History

2017-08-04 15:41:15 -06:00
import * as React from "react";
import { shallow } from "enzyme";
2017-08-04 15:41:15 -06:00
import { NavBar } from "../index";
import { bot } from "../../__test_support__/fake_state/bot";
import { log } from "../../__test_support__/log";
import { taggedUser } from "../../__test_support__/user";
describe("NavBar", () => {
it("has correct parent classname", () => {
const wrapper = shallow(
2017-08-04 15:41:15 -06:00
<NavBar
2017-12-28 13:28:44 -07:00
timeOffset={0}
consistent={true}
2017-08-04 15:41:15 -06:00
logs={[log]}
bot={bot}
user={taggedUser}
2018-03-14 20:50:51 -06:00
dispatch={jest.fn()} />
2017-08-04 15:41:15 -06:00
);
2018-04-02 10:25:46 -06:00
expect(wrapper.find("div").first().hasClass("nav-wrapper")).toBeTruthy();
2017-08-04 15:41:15 -06:00
});
2017-09-05 19:51:38 -06:00
it("closes nav menu", () => {
const wrapper = shallow(<NavBar
2017-12-28 13:28:44 -07:00
timeOffset={0}
consistent={true}
2017-09-05 19:51:38 -06:00
logs={[log]}
bot={bot}
user={taggedUser}
2018-03-14 20:50:51 -06:00
dispatch={jest.fn()} />);
2017-09-05 19:51:38 -06:00
const link = wrapper.find("Link").first();
link.simulate("click");
expect(wrapper.state().mobileMenuOpen).toBeFalsy();
link.simulate("click");
expect(wrapper.state().mobileMenuOpen).toBeFalsy();
});
2017-08-04 15:41:15 -06:00
});