@wix/design-system
Version:
@wix/design-system
29 lines • 1.26 kB
JavaScript
/**
* 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) => ({
...Object.keys(drodownLayoutFromRoot()).reduce((prev, current) => {
return {
...prev,
[]: 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);
},
};
}, {}),
});
//# sourceMappingURL=InputWithOptions.proxy.driver.js.map