UNPKG

@wix/design-system

Version:

@wix/design-system

30 lines 1.31 kB
/** * Used in InputWithOptions.uni.driver only. * * Because popover content (with dropdown inside) is rendered conditionally, this proxy * updates some dropdown methods. */ export const dropdownLayoutDriverProxy = (drodownLayoutFromRoot, dropdownLayoutTestkit, popoverTestkit, inputDriver) => { const proxiedMethods = Object.keys(drodownLayoutFromRoot()).reduce((prev, current) => { return { ...prev, [current]: async (...args) => { const isPopoverShown = await popoverTestkit().isContentElementExists(); if (current === 'isShown' || current === 'exists') { return isPopoverShown; } if (current === 'getDropdown' || current === 'getDropdownItem') { return isPopoverShown ? //@ts-ignore (await dropdownLayoutTestkit())[current](...args) : { isDisplayed: () => false }; } !isPopoverShown && (await inputDriver.click()); //@ts-ignore return await (await dropdownLayoutTestkit())[current](...args); }, }; }, {}); return { ...proxiedMethods }; }; //# sourceMappingURL=InputWithOptions.proxy.driver.js.map