UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

244 lines (234 loc) • 6.05 kB
import { tvActionButtonLabel } from ".."; describe("tvActionButtonLabel", () => { it("generate tv action button label", () => { const output = [ { initial_value: true, key: "label_1_toggle", label: "Enable Label 1", type: "switch", }, { initial_value: "rgba(239, 239, 239, 1)", key: "label_1_font_color", label: "Font Color", type: "color_picker_rgba", }, { initial_value: "rgba(17, 17, 17, 1)", key: "label_1_focused_font_color", label: "Focused Font Color", type: "color_picker_rgba", }, { initial_value: "SFProText-Semibold", key: "label_1_tvos_font_family", label: "tvOS Font Family", type: "tvos_font_selector", }, { initial_value: 24, key: "label_1_tvos_font_size", label: "tvOS Font Size", type: "number_input", }, { initial_value: 40, key: "label_1_tvos_line_height", label: "tvOS Line Height", type: "number_input", }, { initial_value: -0.2, key: "label_1_tvos_letter_spacing", label: "tvOS Letter Spacing", type: "number_input", }, { initial_value: "Roboto-Medium", key: "label_1_android_font_family", label: "Android Font Family", type: "android_font_selector", }, { initial_value: 24, key: "label_1_android_font_size", label: "Android Font Size", type: "number_input", }, { initial_value: 40, key: "label_1_android_line_height", label: "Android Line Height", type: "number_input", }, { initial_value: 0, key: "label_1_android_letter_spacing", label: "Android Letter Spacing", type: "number_input", }, { initial_value: "Miso-Bold", key: "label_1_lg_font_family", label: "LG Font Family", type: "lg_tv_font_selector", }, { initial_value: 24, key: "label_1_lg_font_size", label: "LG Font Size", type: "number_input", }, { initial_value: 40, key: "label_1_lg_line_height", label: "LG Line Height", type: "number_input", }, { initial_value: 0, key: "label_1_lg_letter_spacing", label: "LG Letter Spacing", type: "number_input", }, { initial_value: "SamsungOne-700", key: "label_1_samsung_font_family", label: "Samsung Font Family", type: "samsung_font_selector", }, { initial_value: 24, key: "label_1_samsung_font_size", label: "Samsung Font Size", type: "number_input", }, { initial_value: 40, key: "label_1_samsung_line_height", label: "Samsung Line Height", type: "number_input", }, { initial_value: 0, key: "label_1_samsung_letter_spacing", label: "Samsung Letter Spacing", type: "number_input", }, { initial_value: "left", key: "label_1_text_alignment", label: "Text Alignment", options: [ { text: "Left", value: "left", }, { text: "Right", value: "right", }, { text: "Center", value: "center", }, ], type: "select", }, { initial_value: "default", key: "label_1_text_transform", label: "Text Transform", options: [ { text: "Default", value: "default", }, { text: "Uppercase", value: "uppercase", }, { text: "Lowercase", value: "lowercase", }, { text: "Capitalize", value: "capitalize", }, ], type: "select", }, { initial_value: 1, key: "label_1_number_of_lines", label: "Number Of Lines", type: "number_input", }, { initial_value: 0, key: "label_1_margin_top", label: "Margin Top", type: "number_input", }, { initial_value: 0, key: "label_1_margin_right", label: "Margin Right", type: "number_input", }, { initial_value: 8, key: "label_1_margin_bottom", label: "Margin Bottom", type: "number_input", }, { initial_value: 0, key: "label_1_margin_left", label: "Margin Left", type: "number_input", }, ]; const result = tvActionButtonLabel("Label 1", { enable: true, fontColor: "rgba(239, 239, 239, 1)", focusedFontColor: "rgba(17, 17, 17, 1)", tvosFontFamily: "SFProText-Semibold", tvosFontSize: 24, tvosLineHeight: 40, tvosLetterSpacing: -0.2, androidFontFamily: "Roboto-Medium", androidFontSize: 24, androidLineHeight: 40, androidLetterSpacing: 0, lgFontFamily: "Miso-Bold", lgFontSize: 24, lgLineHeight: 40, lgLetterSpacing: 0, samsungFontFamily: "SamsungOne-700", samsungFontSize: 24, samsungLineHeight: 40, samsungLetterSpacing: 0, textAlignment: "left", textTransform: "default", numberOfLines: 1, marginTop: 0, marginRight: 0, marginBottom: 8, marginLeft: 0, }); expect(result).toEqual(output); }); it("generate empty output if defaults is empty", () => { const output = []; const result = tvActionButtonLabel("Label 1"); expect(result).toEqual(output); }); it("generate empty output if defaults is empty", () => { const output = []; const result = tvActionButtonLabel("Label 1", {}); expect(result).toEqual(output); }); });