@applicaster/zapp-react-native-utils
Version:
Applicaster Zapp React Native utilities package
139 lines (135 loc) • 3.71 kB
JavaScript
import { tvActionButtonsContainer } from "..";
describe("tvActionButtonsContainer", () => {
it("generate tv action buttons", () => {
const output = {
fields: [
{
initial_value: true,
key: "label_buttons_enabled",
label: "Buttons enabled",
type: "switch",
},
{
initial_value: false,
key: "label_independent_styles",
label: "Independent styles",
type: "switch",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: "on_top",
key: "label_position",
label: "Position",
options: ["on_top", "text_label_1", "text_label_2", "text_label_3"],
type: "select",
tooltip:
"<on_top> means that button is placed above all labels. Choose label name here to place button below specific label.", // eslint-disable-line max-len
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: "left",
key: "label_align",
label: "Align",
options: ["left", "center", "right"],
type: "select",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: 1,
key: "label_margin_top",
label: "Margin top",
type: "number_input",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: 2,
key: "label_margin_right",
label: "Margin right",
type: "number_input",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: 3,
key: "label_margin_bottom",
label: "Margin bottom",
type: "number_input",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: 4,
key: "label_margin_left",
label: "Margin left",
type: "number_input",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
{
initial_value: 5,
key: "label_horizontal_gutter",
label: "Horizontal gutter",
type: "number_input",
conditional_fields: [
{
condition_value: true,
key: "styles/label_buttons_enabled",
},
],
},
],
folded: true,
group: true,
label: "label",
tooltip: "description",
};
const result = tvActionButtonsContainer({
label: "label",
description: "description",
defaults: {
buttonsEnabled: true,
independentStyles: false,
position: ["on_top", "text_label_1", "text_label_2", "text_label_3"],
align: "left",
marginTop: 1,
marginRight: 2,
marginBottom: 3,
marginLeft: 4,
horizontalGutter: 5,
},
});
expect(result).toEqual(output);
});
});