import { PopoverMenuUniDriver } from '@wix/design-system/dist/testkit/unidriver';
export function EditableColumnHeaderUniDriver(base, body) {
    const moreButton = base.$('[data-hook$="-more-button"]');
    const getPopoverMenu = async () => {
        const dataHook = await base.attr('data-hook');
        return PopoverMenuUniDriver(body.$(`[data-hook="${dataHook}-menu"]`), body);
    };
    return {
        exists: () => moreButton.exists(),
        /** Whether the "..." more button exists */
        hasMoreButton: () => moreButton.exists(),
        /** Hover the column header (reveals the "..." button in designs that hide it) */
        hover: () => base.hover(),
        /** Click the "..." button to open the popover menu */
        clickMoreButton: () => moreButton.click(),
        /** Whether the popover menu is currently open */
        isMenuOpen: async () => (await getPopoverMenu()).isMenuOpen(),
        /** Number of items in the popover menu */
        menuItemCount: async () => (await getPopoverMenu()).childrenCount(),
        /** Get the text content of a menu item by index */
        getMenuItemText: async (index) => (await getPopoverMenu()).itemContentAt(index),
        /** Click a menu item by index */
        clickMenuItem: async (index) => (await getPopoverMenu()).clickAtChild(index),
        /** Whether the menu item at the given index is disabled */
        isMenuItemDisabled: async (index) => {
            const popover = await getPopoverMenu();
            const contentElement = await popover.getContentElement();
            const item = contentElement
                .$$('[data-hook="dropdown-layout-options"] > *')
                .get(index);
            return (await item.attr('data-option-disabled')) === 'true';
        },
    };
}
//# sourceMappingURL=EditableColumnHeader.uni.driver.js.map