2019-01-13 17:16:22 -07:00
|
|
|
import { locationFormList, dropDownName } from "../location_form_list";
|
2017-10-12 21:50:02 -06:00
|
|
|
import { fakeResourceIndex } from "../test_helpers";
|
|
|
|
|
2019-01-13 16:43:12 -07:00
|
|
|
describe("locationFormList()", () => {
|
2017-10-12 21:50:02 -06:00
|
|
|
it("returns dropdown list", () => {
|
2019-01-13 16:43:12 -07:00
|
|
|
const items = locationFormList(fakeResourceIndex(), []);
|
2019-04-09 22:00:03 -06:00
|
|
|
const coordinate = items[0];
|
|
|
|
expect(coordinate).toEqual({
|
|
|
|
headingId: "Coordinate",
|
|
|
|
label: "Custom Coordinates",
|
|
|
|
value: "",
|
|
|
|
});
|
|
|
|
const toolHeading = items[1];
|
2018-03-14 19:12:21 -06:00
|
|
|
expect(toolHeading).toEqual({
|
|
|
|
headingId: "Tool",
|
|
|
|
label: "Tools",
|
|
|
|
value: 0,
|
|
|
|
heading: true,
|
|
|
|
});
|
2019-04-09 22:00:03 -06:00
|
|
|
const tool = items[2];
|
2018-03-14 19:12:21 -06:00
|
|
|
expect(tool).toEqual({
|
|
|
|
headingId: "Tool",
|
2018-12-20 20:18:10 -07:00
|
|
|
label: "Generic tool (100, 200, 300)",
|
2018-03-14 19:12:21 -06:00
|
|
|
value: "1",
|
|
|
|
});
|
2019-04-09 22:00:03 -06:00
|
|
|
const plantHeading = items[3];
|
2018-03-14 19:12:21 -06:00
|
|
|
expect(plantHeading).toEqual({
|
|
|
|
headingId: "Plant",
|
|
|
|
label: "Plants",
|
|
|
|
value: 0,
|
|
|
|
heading: true,
|
|
|
|
});
|
2019-04-09 22:00:03 -06:00
|
|
|
const plant = items[4];
|
2017-10-12 21:50:02 -06:00
|
|
|
expect(plant).toEqual({
|
|
|
|
headingId: "Plant",
|
2018-03-14 19:12:21 -06:00
|
|
|
label: "Plant 1 (1, 2, 3)",
|
2017-10-12 21:50:02 -06:00
|
|
|
value: "1"
|
|
|
|
});
|
2019-04-09 22:00:03 -06:00
|
|
|
const pointHeading = items[6];
|
2018-03-14 19:12:21 -06:00
|
|
|
expect(pointHeading).toEqual({
|
|
|
|
headingId: "GenericPointer",
|
|
|
|
label: "Map Points",
|
|
|
|
value: 0,
|
|
|
|
heading: true,
|
|
|
|
});
|
2019-04-09 22:00:03 -06:00
|
|
|
const point = items[7];
|
2017-10-12 21:50:02 -06:00
|
|
|
expect(point).toEqual({
|
|
|
|
headingId: "GenericPointer",
|
2018-03-14 19:12:21 -06:00
|
|
|
label: "Point 1 (10, 20, 30)",
|
2017-10-12 21:50:02 -06:00
|
|
|
value: "2"
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("dropDownName()", () => {
|
|
|
|
it("returns label", () => {
|
2018-03-14 19:12:21 -06:00
|
|
|
const label = dropDownName("Plant 1", { x: 10, y: 20, z: 30 });
|
|
|
|
expect(label).toEqual("Plant 1 (10, 20, 30)");
|
2017-10-12 21:50:02 -06:00
|
|
|
});
|
|
|
|
});
|