tests and cleanup

pull/1399/head
gabrielburnworth 2019-08-27 13:54:43 -07:00
parent 4edfa20b60
commit 93d90fac83
5 changed files with 46 additions and 11 deletions

View File

@ -273,7 +273,9 @@
}
.plant-indicator.is-chosen-true {
animation: plant-selection-pop 0.2s 1 cubic-bezier(0, 0, 0, 0.9), pulse-and-rotate 4s 0.2s infinite linear;
&.animate {
animation: plant-selection-pop 0.2s 1 cubic-bezier(0, 0, 0, 0.9), pulse-and-rotate 4s 0.2s infinite linear;
}
transform-origin: center;
transform-box: fill-box;
}

View File

@ -44,6 +44,22 @@ describe("<DesignerNavTabs />", () => {
expect(wrapper.html()).toContain("active");
});
it("renders for points", () => {
mockPath = "/app/designer/points";
mockDev = true;
const wrapper = shallow(<DesignerNavTabs />);
expect(wrapper.hasClass("gray-panel")).toBeTruthy();
expect(wrapper.html()).toContain("active");
});
it("renders for groups", () => {
mockPath = "/app/designer/groups";
mockDev = true;
const wrapper = shallow(<DesignerNavTabs />);
expect(wrapper.hasClass("blue-panel")).toBeTruthy();
expect(wrapper.html()).toContain("active");
});
it("renders for settings", () => {
mockPath = "/app/designer/settings";
mockDev = true;

View File

@ -9,7 +9,8 @@ import {
fakeSavedGarden,
fakePoint,
fakeWebAppConfig,
fakeFarmwareEnv
fakeFarmwareEnv,
fakeSensorReading
} from "../../__test_support__/fake_state/resources";
import { WebAppConfig } from "farmbot/dist/resources/configs/web_app";
import { generateUuid } from "../../resources/util";
@ -82,6 +83,21 @@ describe("mapStateToProps()", () => {
state.resources = buildResourceIndex([webAppConfig, point1, point2, point3]);
expect(mapStateToProps(state).points.length).toEqual(1);
});
it("returns sensor readings", () => {
const state = fakeState();
const sr1 = fakeSensorReading();
sr1.body.created_at = "2018-01-14T20:20:38.362Z";
const sr2 = fakeSensorReading();
sr2.body.created_at = "2018-01-11T20:20:38.362Z";
state.resources = buildResourceIndex([sr1, sr2]);
const uuid1 = Object.keys(state.resources.index.byKind["SensorReading"])[0];
const uuid2 = Object.keys(state.resources.index.byKind["SensorReading"])[1];
expect(mapStateToProps(state).sensorReadings).toEqual([
expect.objectContaining({ uuid: uuid2 }),
expect.objectContaining({ uuid: uuid1 }),
]);
});
});
describe("getPlants()", () => {

View File

@ -62,16 +62,16 @@ export class HoveredPlant extends
animate={animate} />
</g>}
<g id="plant-indicator">
<Circle
className={animate ? "plant-indicator" : ""}
x={qx}
y={qy}
r={scaledRadius}
selected={true} />
</g>
<Circle
className={`plant-indicator ${animate ? "animate" : ""}`}
x={qx}
y={qy}
r={scaledRadius}
selected={true} />
</g>
<g id="hovered-plant-icon">
<image
visibility={hovered ? "visible" : "hidden"}
visibility={"visible"}
style={isEditing ? {} : { pointerEvents: "none" }}
onClick={noop}
className="hovered-plant-copy"

View File

@ -72,7 +72,8 @@ interface NavTabProps {
}
const NavTab = (props: NavTabProps) =>
<Link to={props.linkTo} style={props.icon ? { flex: 0.3 } : {}}
<Link to={props.linkTo} style={(props.icon
&& !DevSettings.futureFeaturesEnabled()) ? { flex: 0.3 } : {}}
className={getCurrentTab() === props.panel ? "active" : ""}>
{DevSettings.futureFeaturesEnabled()
? <img {...common}