@wix/design-system
Version:
@wix/design-system
25 lines • 1.68 kB
JavaScript
import { swatchesDriverFactory as publicDriverFactory } from '../Swatches.uni.driver';
import { fillButtonDriverFactory } from '../../FillButton/FillButton.uni.driver';
import { tooltipDriverFactory } from '../../Tooltip/Tooltip.uni.driver';
import { popoverUniDriverFactory } from '../../Popover/Popover.uni.driver';
import { colorPickerUniDriverFactory } from '../../ColorPicker/ColorPicker.private.uni.driver';
import { dataHooks } from '../constants';
import { fillPreviewDriverFactory } from '../../FillPreview/FillPreview.uni.driver';
export const swatchesPrivateDriverFactory = (base, body) => {
const byHook = (dataHook) => `[data-hook="${dataHook}"]`;
const popoverTestkit = popoverUniDriverFactory(base.$(byHook(dataHooks.addButtonPopover)), body);
const colorPickerTestkit = async (dataHook) => {
const colorPicker = (await popoverTestkit.getContentElementUniDriver()).$(byHook(dataHook));
return colorPickerUniDriverFactory(colorPicker);
};
return {
...publicDriverFactory(base),
getEmptySwatch: () => fillPreviewDriverFactory(base.$(`[data-hook="${dataHooks.empty}"]`)),
getEmptySwatchTooltip: () => tooltipDriverFactory(base.$(`[data-hook="${dataHooks.emptyTooltip}"]`), body),
getAddButton: () => fillButtonDriverFactory(base.$(`[data-hook="${dataHooks.addButton}"]`), body),
isColorPickerShown: () => popoverTestkit.isContentElementExists(),
clickOutsideColorPicker: () => popoverTestkit.clickOutside(),
getColorPicker: async (dataHook = dataHooks.addButtonColorPicker) => colorPickerTestkit(dataHook),
};
};
//# sourceMappingURL=Swatches.private.uni.driver.js.map