UNPKG

@wix/design-system

Version:

@wix/design-system

109 lines 5.46 kB
import { Simulate } from 'react-dom/test-utils'; import { BaseDriver } from '@wix/wix-ui-test-utils/driver-factory'; import { PopoverMenuUniDriver } from '../PopoverMenu/PopoverMenu.uni.driver'; import { tooltipLegacyDriverFactory } from '../Tooltip/Tooltip.driver'; export interface TableActionCellDriver<T = HTMLElement> extends BaseDriver { element: () => T; exists: () => boolean; clickPrimaryActionButton: () => void; getIsPrimaryActionButtonDisabled: () => boolean; getPrimaryActionButtonVisibility: () => 'onHover' | 'always'; primaryActionButtonPrefixIconExists: () => boolean; primaryActionButtonSuffixIconExists: () => boolean; getVisibleActionsCount: () => number; getHiddenActionsCount: () => number; getVisibleActionTooltipDriver: (action: number) => ReturnType<typeof tooltipLegacyDriverFactory>; getVisibleActionByDataHookTooltipDriver: (dataHook: string) => ReturnType<typeof tooltipLegacyDriverFactory>; getHiddenActionsPopoverMenuDriver: () => PopoverMenuUniDriver; clickVisibleAction: (actionIndex: number) => void; clickVisibleActionByDataHook: (actionDataHook: string) => void; clickPopoverMenu: () => void; clickHiddenAction: (actionIndex: number) => void; clickHiddenActionByDataHook: (actionDataHook: string) => void; getMoreActionsTooltipText: () => string; } declare const tableActionCellDriverFactory: ({ element, wrapper, eventTrigger, }: { element: HTMLElement; wrapper: HTMLElement; eventTrigger: typeof Simulate; }) => { /** Get the element */ element: () => HTMLElement; /** Whether the element exists */ exists: () => boolean; /** Get the driver of the primary action <Button/> from the action column */ getPrimaryActionButtonDriver: () => { exists: () => boolean; click: () => void; isButtonDisabled: () => boolean; isPrefixIconExists: () => boolean; isSuffixIconExists: () => boolean; }; /** Click the primary action button from the action column */ clickPrimaryActionButton: () => void; /** Get whether the primary action button is disabled */ getIsPrimaryActionButtonDisabled: () => boolean; /** * Gets primary action visibility value * @returns {Promise<'onHover' | 'always'>} */ getPrimaryActionButtonVisibility: () => string | null; /** Get whether the primary action button prefix icon exists */ primaryActionButtonPrefixIconExists: () => boolean; /** Get whether the primary action button suffix icon exists */ primaryActionButtonSuffixIconExists: () => boolean; /** Get the number of the visible secondary actions */ getVisibleActionsCount: () => number; /** Get the number of hidden secondary actions (in the <PopoverMenu/>, requires it to be open) */ getHiddenActionsCount: () => Promise<number>; /** Get the driver of a specific visible secondary action <Tooltip/> */ getVisibleActionTooltipDriver: (actionIndex: number) => { exists: () => Promise<boolean>; tooltipExists: () => Promise<boolean>; mouseEnter: () => Promise<void | undefined>; mouseLeave: () => Promise<void | undefined>; clickOutside: () => Promise<void>; getTooltipText: () => string | null | undefined; hasSize: (sizeName: import("..").TooltipSize) => boolean; }; /** Get the driver of a specific visible secondary action <Tooltip/> by its specified dataHook */ getVisibleActionByDataHookTooltipDriver: (dataHook: string) => { exists: () => Promise<boolean>; tooltipExists: () => Promise<boolean>; mouseEnter: () => Promise<void | undefined>; mouseLeave: () => Promise<void | undefined>; clickOutside: () => Promise<void>; getTooltipText: () => string | null | undefined; hasSize: (sizeName: import("..").TooltipSize) => boolean; }; /** Get the driver of a specific visible secondary action <Button/> */ getVisibleActionButtonDriver: (actionIndex: number) => { exists: () => boolean; click: () => void; isButtonDisabled: () => boolean; isPrefixIconExists: () => boolean; isSuffixIconExists: () => boolean; }; /** Get the driver of a specific visible secondary action <Button/> by its specified dataHook */ getVisibleActionByDataHookButtonDriver: (dataHook: string) => { exists: () => boolean; click: () => void; isButtonDisabled: () => boolean; isPrefixIconExists: () => boolean; isSuffixIconExists: () => boolean; }; /** Get the driver of the hidden secondary action <PopoverMenu/> */ getHiddenActionsPopoverMenuDriver: () => PopoverMenuUniDriver; /** Click an a visible secondary action */ clickVisibleAction: (actionIndex: number) => void; /** Click an a visible secondary action by its specified dataHook */ clickVisibleActionByDataHook: (actionDataHook: string) => void; /** Click on the hidden secondary actions <PopoverMenu/> */ clickPopoverMenu: () => Promise<void>; /** Click on a hidden secondary action (requires the <PopoverMenu/> to be open) */ clickHiddenAction: (actionIndex: number) => Promise<void>; clickHiddenActionByDataHook: (actionDataHook: string) => Promise<void>; getMoreActionsTooltipText: () => string | null; }; export default tableActionCellDriverFactory; //# sourceMappingURL=TableActionCell.driver.d.ts.map