UNPKG

wix-style-react

Version:
29 lines 1.48 kB
import { baseUniDriverFactory, findByHook, } from '../test-utils/utils/unidriver'; import { sidebarItemButtonNextDriverFactory } from './SidebarItemButtonNext.uni.driver'; import { dataHooks } from './constants'; export const sidebarItemNextDriverFactory = (base, body) => { // SidebarItemNext is just a small wrapper for SidebarItemButtonNext, so we // reuse SidebarItemButtonNext driver. // We can't simply spread the driver because `findByHook` might become async // in the near future and the driver factory itself is sync. const getButtonDriver = async () => { const button = await findByHook(base, dataHooks.button); return sidebarItemButtonNextDriverFactory(button, body); }; const getButtonDriverMethod = methodName => async (...args) => { const buttonDriver = await getButtonDriver(); return buttonDriver[methodName](...args); }; return { ...baseUniDriverFactory(base, body), click: getButtonDriverMethod('click'), isSelected: getButtonDriverMethod('isSelected'), isDisabled: getButtonDriverMethod('isDisabled'), suffixExists: getButtonDriverMethod('suffixExists'), getSuffixCount: getButtonDriverMethod('getSuffixCount'), prefixExists: getButtonDriverMethod('prefixExists'), getSkin: getButtonDriverMethod('getSkin'), getText: getButtonDriverMethod('getText'), }; }; //# sourceMappingURL=SidebarItemNext.uni.driver.js.map