UNPKG

@wix/design-system

Version:

@wix/design-system

53 lines 2.25 kB
import { baseUniDriverFactory, findByHookAtIndex, } from '../utils/test-utils/unidriver'; import { dataHooks } from './constants'; const accordionDriverFactory = (base) => ({ ...baseUniDriverFactory(base), // Gets the title by item index getItemTitleAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="title"]') .text(), // Gets the subtitle by item index getItemSubtitleAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="accordion-item-subtitle"]') .text(), // Checks whether an icon exist at item index /** * @deprecated * use 'isPrefixExistsAt' instead */ isIconExistsAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="icon"]') .exists(), // Checks whether prefix exists at item index isPrefixExistsAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="icon"]') .exists(), // Checks whether suffix exists at item index isSuffixExistsAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="suffix"]') .exists(), // Checks whether an item is expanded at index isItemExpandedAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="children"]') .exists(), // Clicks toggle button at item index clickToggleButtonAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$(`[data-hook="${dataHooks.toggleButton}"]`) .click(), // Clicks item at index clickItemAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$('[data-hook="header"]') .click(), // Gets toggle button label at item index getToggleButtonLabelAt: (idx) => findByHookAtIndex(base, dataHooks.item, idx) .$(`[data-hook="${dataHooks.toggleButton}"]`) .text(), // Gets transition speed getTransitionSpeed: () => base.attr('data-transition-speed'), // Returns skin getSkin: () => base.attr('data-skin'), // Returns size of horizontal padding getHorizontalPadding: () => base.attr('data-horizontal-padding'), }); export default accordionDriverFactory; //# sourceMappingURL=Accordion.uni.driver.js.map