2017-07-26 14:29:35 -06:00
|
|
|
import { mount } from "enzyme";
|
|
|
|
import { AxisDisplayGroup } from "../axis_display_group";
|
|
|
|
|
|
|
|
describe("<AxisDisplayGroup />", () => {
|
2017-08-28 05:49:13 -06:00
|
|
|
const params = {
|
2017-08-02 15:59:18 -06:00
|
|
|
position: { x: undefined, y: undefined, z: undefined },
|
|
|
|
label: "Heyoo"
|
|
|
|
};
|
2017-08-28 05:49:13 -06:00
|
|
|
const wrapper = mount(AxisDisplayGroup(params));
|
2017-07-27 14:04:01 -06:00
|
|
|
|
2017-07-26 14:29:35 -06:00
|
|
|
it("has 3 inputs and a label", () => {
|
|
|
|
expect(wrapper.find("input").length).toEqual(3);
|
|
|
|
expect(wrapper.find("label").length).toEqual(1);
|
|
|
|
});
|
2017-07-27 14:04:01 -06:00
|
|
|
|
2017-07-27 14:45:01 -06:00
|
|
|
it("renders '' for falsy values", () => {
|
2017-08-28 05:49:13 -06:00
|
|
|
const inputs = wrapper.find("input");
|
|
|
|
const label = wrapper.find("label");
|
2017-07-27 14:04:01 -06:00
|
|
|
expect(inputs.at(0).props().value).toBe("");
|
|
|
|
expect(inputs.at(1).props().value).toBe("");
|
|
|
|
expect(inputs.at(2).props().value).toBe("");
|
2017-07-26 14:29:35 -06:00
|
|
|
expect(label.text()).toBe("Heyoo");
|
|
|
|
});
|
2017-07-27 14:45:01 -06:00
|
|
|
|
|
|
|
it("renders real values for ... real values", () => {
|
2017-08-28 05:49:13 -06:00
|
|
|
const props = {
|
2017-08-02 15:59:18 -06:00
|
|
|
position: { x: 0, y: 0, z: 0 },
|
|
|
|
label: "Heyoo"
|
|
|
|
};
|
|
|
|
props.position = {
|
2017-07-27 14:45:01 -06:00
|
|
|
x: 1,
|
|
|
|
y: 2,
|
|
|
|
z: 3
|
|
|
|
};
|
2017-08-28 05:49:13 -06:00
|
|
|
const el = mount(AxisDisplayGroup(props));
|
|
|
|
const inputs = el.find("input");
|
|
|
|
const label = el.find("label");
|
2017-07-27 14:45:01 -06:00
|
|
|
|
|
|
|
expect(inputs.at(0).props().value).toBe(1);
|
|
|
|
expect(inputs.at(1).props().value).toBe(2);
|
|
|
|
expect(inputs.at(2).props().value).toBe(3);
|
|
|
|
expect(label.text()).toBe("Heyoo");
|
|
|
|
});
|
2017-07-26 14:29:35 -06:00
|
|
|
});
|