PromucFlow_constructor/app/client/src/components/propertyControls/ButtonTabControl.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

51 lines
1.3 KiB
TypeScript

import ButtonTabControl from "./ButtonTabControl";
const requiredParams = {
evaluatedValue: undefined,
widgetProperties: undefined,
parentPropertyName: "",
parentPropertyValue: undefined,
additionalDynamicData: {},
label: "",
propertyName: "",
controlType: "",
isBindProperty: false,
isTriggerProperty: false,
};
const options = [
{
icon: "BOLD_FONT",
value: "BOLD",
},
{
icon: "ITALICS_FONT",
value: "ITALIC",
},
];
const config = { ...requiredParams, options };
describe("ButtonTabControl.canDisplayValue", () => {
it("Should return true when a value in the option is passed", () => {
expect(ButtonTabControl.canDisplayValueInUI(config, "BOLD")).toEqual(true);
expect(ButtonTabControl.canDisplayValueInUI(config, "ITALIC")).toEqual(
true,
);
expect(ButtonTabControl.canDisplayValueInUI(config, "ITALIC,BOLD")).toEqual(
true,
);
expect(ButtonTabControl.canDisplayValueInUI(config, "BOLD,ITALIC")).toEqual(
true,
);
});
it("Should return false when a value that is not in the option is passed", () => {
expect(ButtonTabControl.canDisplayValueInUI(config, "BLABLA")).toEqual(
false,
);
expect(ButtonTabControl.canDisplayValueInUI(config, "BOLD,BLABLA")).toEqual(
false,
);
});
});