wix-style-react
Version:
33 lines (29 loc) • 906 B
JavaScript
export const dropdownLayoutDriverProxy = (
drodpwnLayoutDummy,
dropdownLayoutTestkit,
popoverTestkit,
inputTestkit,
) => {
return {
...Object.keys(drodpwnLayoutDummy()).reduce((prev, current) => {
return {
...prev,
[]: async args => {
const isPopoverShown = await (
await popoverTestkit()
).isContentElementExists();
if (current === 'isShown' || current === 'exists') {
return isPopoverShown;
}
if (current === 'getDropdown' || current === 'getDropdownItem') {
return isPopoverShown
? (await dropdownLayoutTestkit())[current](args)
: { isDisplayed: () => false };
}
!isPopoverShown && (await inputTestkit.click());
return await (await dropdownLayoutTestkit())[current](args);
},
};
}, {}),
};
};