PromucFlow_constructor/app/client/src/components/propertyControls/SwitchControl.test.tsx
Aswath K c29fd2db19
chore: Adds canDisplayValue to property controls (#13309)
* Adds canDisplayValue to property controls

* Adds tests

* add fn for LocationSearch & ActionSelector

* Adds CSV value support in ButtonTabControl
2022-06-03 10:37:02 +05:30

30 lines
841 B
TypeScript

import SwitchControl from "./SwitchControl";
const requiredParams = {
evaluatedValue: undefined,
widgetProperties: undefined,
parentPropertyName: "",
parentPropertyValue: undefined,
additionalDynamicData: {},
label: "",
propertyName: "",
controlType: "",
isBindProperty: false,
isTriggerProperty: false,
};
const config = { ...requiredParams };
describe("SwitchControl.canDisplayValue", () => {
it("Should return true when 'true' or 'false' is passed", () => {
expect(SwitchControl.canDisplayValueInUI(config, "true")).toEqual(true);
expect(SwitchControl.canDisplayValueInUI(config, "false")).toEqual(true);
});
it("Should return false when a value other than 'true' or 'false' is passed", () => {
expect(SwitchControl.canDisplayValueInUI(config, "{{true}}")).toEqual(
false,
);
});
});