2020-10-16 13:16:01 +00:00
|
|
|
import React from "react";
|
|
|
|
import { mount } from "enzyme";
|
|
|
|
import MainButton from ".";
|
|
|
|
import Button from "../button";
|
2019-09-08 14:47:55 +00:00
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
describe("<MainButton />", () => {
|
|
|
|
it("renders without error", () => {
|
2019-09-08 14:47:55 +00:00
|
|
|
const wrapper = mount(
|
2020-10-16 13:16:01 +00:00
|
|
|
<MainButton text="Button" isDisabled={false} isDropdown={true}>
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label="Some button" />
|
2019-09-08 14:47:55 +00:00
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
|
|
|
expect(wrapper).toExist();
|
|
|
|
});
|
2019-12-03 11:47:48 +00:00
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
it("accepts id", () => {
|
2019-12-03 11:47:48 +00:00
|
|
|
const wrapper = mount(
|
2020-10-16 13:16:01 +00:00
|
|
|
<MainButton
|
|
|
|
text="Button"
|
|
|
|
isDisabled={false}
|
|
|
|
isDropdown={true}
|
|
|
|
id="testId"
|
|
|
|
>
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label="Some button" />
|
2019-12-03 11:47:48 +00:00
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
expect(wrapper.prop("id")).toEqual("testId");
|
2019-12-03 11:47:48 +00:00
|
|
|
});
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
it("accepts className", () => {
|
2019-12-03 11:47:48 +00:00
|
|
|
const wrapper = mount(
|
2020-10-16 13:16:01 +00:00
|
|
|
<MainButton
|
|
|
|
text="Button"
|
|
|
|
isDisabled={false}
|
|
|
|
isDropdown={true}
|
|
|
|
className="test"
|
|
|
|
>
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label="Some button" />
|
2019-12-03 11:47:48 +00:00
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
expect(wrapper.prop("className")).toEqual("test");
|
2019-12-03 11:47:48 +00:00
|
|
|
});
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
it("accepts style", () => {
|
2019-12-03 11:47:48 +00:00
|
|
|
const wrapper = mount(
|
2020-10-16 13:16:01 +00:00
|
|
|
<MainButton
|
|
|
|
text="Button"
|
|
|
|
isDisabled={false}
|
|
|
|
isDropdown={true}
|
|
|
|
style={{ color: "red" }}
|
|
|
|
>
|
|
|
|
<div>Some button</div>
|
|
|
|
<Button label="Some button" />
|
2019-12-03 11:47:48 +00:00
|
|
|
</MainButton>
|
|
|
|
);
|
|
|
|
|
2020-10-16 13:16:01 +00:00
|
|
|
expect(wrapper.getDOMNode().style).toHaveProperty("color", "red");
|
2019-12-03 11:47:48 +00:00
|
|
|
});
|
2019-09-08 14:47:55 +00:00
|
|
|
});
|