"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SwitchTest = void 0;
var tslib_1 = require("tslib");
var React = tslib_1.__importStar(require("react"));
var react_native_1 = require("react-native");
var react_native_2 = require("react-native");
var button_1 = require("@fluentui-react-native/button");
var switch_1 = require("@fluentui-react-native/switch");
var CustomizedSwitch_1 = require("./CustomizedSwitch");
var E2ESwitchTest_1 = require("./E2ESwitchTest");
var consts_1 = require("../../../../E2E/src/Switch/consts");
var styles_1 = require("../Common/styles");
var Test_1 = require("../Test");
var styles = react_native_1.StyleSheet.create({
    square: {
        backgroundColor: 'red',
        width: 100,
        height: 100,
    },
});
var StandardUsage = function () {
    var memoizedStyles = React.useMemo(function () { return (react_native_2.Platform.OS === 'android' ? tslib_1.__assign(tslib_1.__assign({}, styles_1.commonTestStyles.androidContainer), { height: 180 }) : styles_1.commonTestStyles.settingsPicker); }, []);
    return (React.createElement(react_native_1.View, { style: memoizedStyles },
        React.createElement(switch_1.Switch, { defaultChecked: true, label: 'Default Checked True' }),
        React.createElement(switch_1.Switch, { defaultChecked: false, label: 'Default Checked False' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, label: 'Disabled Default Checked True', disabled: true }),
        React.createElement(switch_1.Switch, { defaultChecked: false, label: 'Disabled Default Checked False', disabled: true })));
};
var OnChangeUsage = function () {
    var _a = React.useState(true), displaySquare = _a[0], setDisplaySquare = _a[1];
    var defaultToggleSquare = function (_e, checked) {
        setDisplaySquare(checked);
    };
    var memoizedStyles = React.useMemo(function () { return (react_native_2.Platform.OS === 'android' ? tslib_1.__assign(tslib_1.__assign({}, styles_1.commonTestStyles.androidContainer), { height: 150 }) : styles_1.commonTestStyles.settingsPicker); }, []);
    return (React.createElement(react_native_1.View, { style: memoizedStyles },
        React.createElement(switch_1.Switch, { label: 'Toggle Square', defaultChecked: true, onChange: defaultToggleSquare }),
        displaySquare && React.createElement(react_native_1.View, { style: styles.square })));
};
var ControlSwitchValues = function () {
    var _a = React.useState(true), toggleSwitch = _a[0], setToggleSwitch = _a[1];
    var toggleSwitchTrue = function () {
        setToggleSwitch(true);
    };
    var toggleSwitchFalse = function () {
        setToggleSwitch(false);
    };
    var memoizedStyles = React.useMemo(function () { return (react_native_2.Platform.OS === 'android' ? tslib_1.__assign(tslib_1.__assign({}, styles_1.commonTestStyles.androidContainer), { height: 150 }) : styles_1.commonTestStyles.settingsPicker); }, []);
    return (React.createElement(react_native_1.View, { style: memoizedStyles },
        React.createElement(button_1.ButtonV1, { onClick: toggleSwitchTrue }, "Toggle Switch True"),
        React.createElement(button_1.ButtonV1, { onClick: toggleSwitchFalse }, "Toggle Switch False"),
        React.createElement(switch_1.Switch, { label: 'Switch Value Being Controlled', checked: toggleSwitch })));
};
var LabelPosition = function () {
    return (React.createElement(react_native_1.View, { style: styles_1.commonTestStyles.settingsPicker },
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'before', label: 'before' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'after', label: 'after' }),
        react_native_2.Platform.OS !== 'android' && React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'above', label: 'above' })));
};
var OnOffText = function () {
    return (React.createElement(react_native_1.View, { style: styles_1.commonTestStyles.settingsPicker },
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'before', label: 'Autosave', onText: 'On', offText: 'Off' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'above', label: 'Autosave', onText: 'On', offText: 'Off' }),
        React.createElement(switch_1.Switch, { defaultChecked: true, labelPosition: 'after', label: 'Autosave', onText: 'On', offText: 'Off' })));
};
var toggleSections = [
    {
        name: 'Standard Usage',
        testID: consts_1.SWITCH_TESTPAGE,
        component: function () { return React.createElement(StandardUsage, null); },
    },
    {
        name: 'onChange Usage',
        component: function () { return React.createElement(OnChangeUsage, null); },
    },
    {
        name: 'Control Switch Values',
        component: function () { return React.createElement(ControlSwitchValues, null); },
    },
    react_native_2.Platform.select({
        android: null,
        default: {
            name: 'Label Position',
            component: function () { return React.createElement(LabelPosition, null); },
        },
    }),
    react_native_2.Platform.select({
        android: null,
        default: {
            name: 'On/Off Text',
            component: function () { return React.createElement(OnOffText, null); },
        },
    }),
    react_native_2.Platform.select({
        android: null,
        default: {
            name: 'Customized Tokens',
            component: function () { return React.createElement(CustomizedSwitch_1.CustomizedSwitch, null); },
        },
    }),
];
var e2eSections = [
    {
        name: 'Switch E2E Testing',
        component: E2ESwitchTest_1.E2ESwitchTest,
    },
];
var SwitchTest = function () {
    var status = {
        win32Status: 'Production',
        uwpStatus: 'Backlog',
        iosStatus: 'Backlog',
        macosStatus: 'Backlog',
        androidStatus: 'Experimental',
    };
    var description = 'Switch is a control that has two mutually exclusive states.';
    var spec = 'https://github.com/microsoft/fluentui-react-native/blob/main/packages/components/Switch/SPEC.md';
    return (React.createElement(Test_1.Test, { name: "Switch Test", description: description, spec: spec, sections: toggleSections, status: status, e2eSections: e2eSections }));
};
exports.SwitchTest = SwitchTest;
//# sourceMappingURL=SwitchTest.js.map