"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.E2EMenuTest = void 0;
const React = __importStar(require("react"));
const react_native_1 = require("react-native");
const button_1 = require("@fluentui-react-native/button");
const e2e_testing_1 = require("@fluentui-react-native/e2e-testing");
const menu_1 = require("@fluentui-react-native/menu");
const stack_1 = require("@fluentui-react-native/stack");
const text_1 = require("@fluentui-react-native/text");
const styles_1 = require("../Common/styles");
const TestProps_1 = require("../Common/TestProps");
const E2EMenuTest = () => {
    const [menuOpened, setMenuOpened] = React.useState(false);
    const [numOnClickCalls, setNumOnClickCalls] = React.useState(0);
    const onOpenChange = React.useCallback((_e, isOpen) => {
        setMenuOpened(isOpen);
    }, [setMenuOpened]);
    const onItemClick = () => {
        setNumOnClickCalls((n) => n + 1);
    };
    const onResetClick = () => {
        setNumOnClickCalls(0);
    };
    return (React.createElement(stack_1.Stack, { style: styles_1.stackStyle },
        React.createElement(react_native_1.View, { style: { flexDirection: 'row' } },
            menuOpened ? (React.createElement(text_1.TextV1 /* For Android E2E testing purposes, testProps must be passed in after accessibilityLabel. */, { ...(0, TestProps_1.testProps)(e2e_testing_1.MENU_ON_OPEN) }, "Menu opened")) : (React.createElement(text_1.TextV1 /* For Android E2E testing purposes, testProps must be passed in after accessibilityLabel. */, { ...(0, TestProps_1.testProps)(e2e_testing_1.MENU_ON_CLOSE) }, "Menu closed")),
            React.createElement(button_1.ButtonV1, { onClick: onResetClick, ...(0, TestProps_1.testProps)(e2e_testing_1.MENU_CALLBACK_RESET_BUTTON) }, "Reset Item Callback"),
            React.createElement(menu_1.Menu, { open: menuOpened, onOpenChange: onOpenChange },
                React.createElement(menu_1.MenuTrigger, null,
                    React.createElement(button_1.ButtonV1
                    /* For Android E2E testing purposes, testProps must be passed in after accessibilityLabel. */
                    , { ...(0, TestProps_1.testProps)(e2e_testing_1.MENUTRIGGER_TEST_COMPONENT) }, "Test")),
                React.createElement(menu_1.MenuPopover
                /* For Android E2E testing purposes, testProps must be passed in after accessibilityLabel. */
                , { ...(0, TestProps_1.testProps)(e2e_testing_1.MENUPOPOVER_TEST_COMPONENT) },
                    React.createElement(menu_1.MenuList, null,
                        React.createElement(menu_1.MenuGroup, null,
                            React.createElement(menu_1.MenuItem, { onClick: onItemClick, accessibilityLabel: e2e_testing_1.MENUITEM_ACCESSIBILITY_LABEL, persistOnClick: true, ...(0, TestProps_1.testProps)(e2e_testing_1.MENUITEM_TEST_COMPONENT) }, "A plain MenuItem"),
                            React.createElement(menu_1.MenuItem, { onClick: onItemClick, ...(0, TestProps_1.testProps)(e2e_testing_1.MENUITEM_DISABLED_COMPONENT), disabled: true, persistOnClick: true }, "A second disabled plain MenuItem")),
                        React.createElement(menu_1.MenuDivider, null),
                        React.createElement(menu_1.MenuGroup, null,
                            React.createElement(menu_1.MenuItem
                            /* For Android E2E testing purposes, testProps must be passed in after accessibilityLabel. */
                            , { ...(0, TestProps_1.testProps)(e2e_testing_1.MENUITEM_NO_A11Y_LABEL_COMPONENT) }, e2e_testing_1.MENUITEM_TEST_LABEL),
                            React.createElement(menu_1.MenuItem
                            /* For Android E2E testing purposes, testProps must be passed in after accessibilityLabel. */
                            , { ...(0, TestProps_1.testProps)(e2e_testing_1.MENUITEM_FOURTH_COMPONENT) }, "A fourth plain MenuItem")))))),
        React.createElement(text_1.TextV1, { style: { marginVertical: 4 }, ...(0, TestProps_1.testProps)(e2e_testing_1.MENUITEM_CALLBACK_LABEL) }, `onClick fired ${numOnClickCalls} times`)));
};
exports.E2EMenuTest = E2EMenuTest;
//# sourceMappingURL=E2EMenuTest.js.map