<PlantLayer/> test updates

pull/1381/head
Rick Carlino 2019-08-19 11:05:13 -05:00
parent 3a917060b4
commit bfd877f86a
7 changed files with 15 additions and 6 deletions

View File

@ -48,7 +48,7 @@ describe("clickMapPlant", () => {
});
it("adds a point to current group if group editor is active", () => {
mockMode = "addPlantToGroup";
mockMode = "addPointToGroup";
const state = fakeState();
const plant = fakePlant();
plant.body.id = 23;

View File

@ -4,12 +4,12 @@ import { edit, overwrite } from "../api/crud";
import { history } from "../history";
import { Actions } from "../constants";
import { svgToUrl, DEFAULT_ICON } from "../open_farm/icons";
import { getMode } from "./map/util";
import { Mode } from "./map/interfaces";
import { clamp, uniq } from "lodash";
import { GetState } from "../redux/interfaces";
import { fetchGroupFromUrl } from "./point_groups/group_detail";
import { TaggedPoint } from "farmbot";
import { getMode } from "./map/util";
export function movePlant(payload: MovePlantProps) {
const tr = payload.plant;

View File

@ -15,10 +15,10 @@ import {
getMapSize,
transformXY,
transformForQuadrant,
getMode,
getGardenCoordinates,
MapPanelStatus,
mapPanelClassName,
getMode,
} from "../util";
import { McuParams } from "farmbot";
import {

View File

@ -2,9 +2,9 @@ import { isNumber } from "lodash";
import { TaggedPlant, AxisNumberProperty, Mode } from "../interfaces";
import { SelectionBoxData } from "./selection_box";
import { GardenMapState } from "../../interfaces";
import { getMode } from "../util";
import { history } from "../../../history";
import { selectPlant } from "../../actions";
import { getMode } from "../util";
/** Return all plants within the selection box. */
export const getSelected = (

View File

@ -5,7 +5,7 @@ import {
MapTransformProps, TaggedPlant, Mode, AxisNumberProperty
} from "./interfaces";
import { GardenMapProps, GardenMapState } from "../interfaces";
import { getMapSize, getMode, getGardenCoordinates } from "./util";
import { getMapSize, getGardenCoordinates, getMode } from "./util";
import {
Grid, MapBackground,
TargetCoordinate,

View File

@ -142,5 +142,5 @@ export enum Mode {
moveTo = "moveTo",
createPoint = "createPoint",
templateView = "templateView",
addPointToGroup = "addPlantToGroup",
addPointToGroup = "addPointToGroup",
}

View File

@ -62,6 +62,7 @@ describe("<PlantLayer/>", () => {
it("is in non-clickable mode", () => {
mockPath = "/app/designer/plants/select";
const p = fakeProps();
const wrapper = svgMount(<PlantLayer {...p} />);
expect(wrapper.find("Link").props().style)
.toEqual({ pointerEvents: "none" });
@ -125,4 +126,12 @@ describe("<PlantLayer/>", () => {
expect((wrapper.find("Link").props()).style)
.toEqual({ pointerEvents: "none" });
});
it("wraps the component in <g> (instead of <Link>", () => {
mockPath = "/app/designer/groups/15";
const p = fakeProps();
const wrapper = svgMount(<PlantLayer {...p} />);
expect(wrapper.find("a").length).toBe(0);
expect(wrapper.find("g").length).toBeGreaterThan(0);
});
});