@wix/design-system
Version:
@wix/design-system
25 lines • 1.18 kB
JavaScript
import { baseUniDriverFactory, ReactBase, isElementFocused, findByHook, } from '../utils/test-utils/unidriver';
import { dataHooks } from './constants';
export const editableTitleUniDriverFactory = base => {
const input = findByHook(base, dataHooks.input);
const heading = findByHook(base, dataHooks.heading);
const reactBaseInput = ReactBase(input);
return {
...baseUniDriverFactory(base),
getInput: () => {
return {
enterText: async (value) => await input.enterValue(value),
keyDown: async (eventData) => await reactBaseInput.keyDown(eventData),
blur: async () => await reactBaseInput.blur(),
focus: async () => await reactBaseInput.focus(),
isFocus: async () => isElementFocused(input),
getMaxLength: async () => await input.attr('maxLength'),
getValue: async () => await input.value(),
getText: async () => await input.value(),
};
},
getHeadingText: () => heading.text(),
clickHeading: () => heading.click(),
};
};
//# sourceMappingURL=EditableTitle.uni.driver.js.map