long scaling factor
parent
f8ab60ea38
commit
fed4add808
|
@ -1,7 +1,7 @@
|
|||
import * as React from "react";
|
||||
import { mount } from "enzyme";
|
||||
import { mount, shallow } from "enzyme";
|
||||
import { EncodersAndEndStops } from "../encoders_and_endstops";
|
||||
import { EncodersProps } from "../../interfaces";
|
||||
import { EncodersProps, NumericMCUInputGroupProps } from "../../interfaces";
|
||||
import { panelState } from "../../../../__test_support__/control_panel_state";
|
||||
import { bot } from "../../../../__test_support__/fake_state/bot";
|
||||
import { Dictionary } from "farmbot";
|
||||
|
@ -30,4 +30,17 @@ describe("<EncodersAndEndStops />", () => {
|
|||
const wrapper = mount(<EncodersAndEndStops {...fakeProps()} />);
|
||||
expect(wrapper.text().toLowerCase()).not.toContain("invert endstops");
|
||||
});
|
||||
|
||||
const intSizeTest = (size: "short" | "long") =>
|
||||
it(`uses ${size} int scaling factor`, () => {
|
||||
mockFeatures.long_scaling_factor = size === "short" ? false : true;
|
||||
const wrapper = shallow(<EncodersAndEndStops {...fakeProps()} />);
|
||||
const sfProps = wrapper.find("NumericMCUInputGroup").at(2)
|
||||
.props() as NumericMCUInputGroupProps;
|
||||
expect(sfProps.name).toEqual("Encoder Scaling");
|
||||
expect(sfProps.intSize).toEqual(size);
|
||||
});
|
||||
|
||||
intSizeTest("short");
|
||||
intSizeTest("long");
|
||||
});
|
||||
|
|
|
@ -76,6 +76,7 @@ export function EncodersAndEndStops(props: EncodersProps) {
|
|||
x={"encoder_scaling_x"}
|
||||
y={"encoder_scaling_y"}
|
||||
z={"encoder_scaling_z"}
|
||||
intSize={shouldDisplay(Feature.long_scaling_factor) ? "long" : "short"}
|
||||
gray={encodersDisabled}
|
||||
sourceFwConfig={sourceFwConfig}
|
||||
dispatch={dispatch} />
|
||||
|
|
|
@ -77,6 +77,7 @@ export enum Feature {
|
|||
api_farmware_installations = "api_farmware_installations",
|
||||
api_farmware_env = "api_farmware_env",
|
||||
use_update_channel = "use_update_channel",
|
||||
long_scaling_factor = "long_scaling_factor",
|
||||
}
|
||||
/** Object fetched from FEATURE_MIN_VERSIONS_URL. */
|
||||
export type MinOsFeatureLookup = Partial<Record<Feature, string>>;
|
||||
|
|
Loading…
Reference in New Issue