UNPKG

@wix/design-system

Version:

@wix/design-system

55 lines 1.96 kB
import { baseUniDriverFactory, isElementFocused, } from '../utils/test-utils/unidriver'; import { dataHooks } from './AngleInput.constants'; export const angleInputDriverFactory = (base) => { const getElementByHook = (hook) => base.$(`[data-hook=${hook}]`); const input = getElementByHook(dataHooks.input); return { ...baseUniDriverFactory(base), /** * Checks if the input element is focused. */ isFocused: async () => await isElementFocused(input), /** * Checks if the input element is disabled. */ isDisabled: async () => { const disabledAttr = await input.attr('disabled'); return disabledAttr !== null; }, /** * Focuses the input element. */ focus: async () => (await input.getNative()).focus(), /** * Blurs the input element. */ blur: async () => (await input.getNative()).blur(), /** * Retrieves the value of the input element. */ getValue: async () => await input.value(), /** * Sets the value of the input element. */ setValue: async (value) => await input.enterValue(value), /** * Increases the angle by pressing the 'ArrowUp' key a specified number of times. */ incrementByStepCount: async (times) => { (await input.getNative()).focus(); for (let i = 0; i < times; i++) { await input.pressKey('ArrowUp'); } }, /** * Decreases the angle by pressing the 'ArrowDown' key a specified number of times. */ decrementByStepCount: async (times) => { (await input.getNative()).focus(); for (let i = 0; i < times; i++) { await input.pressKey('ArrowDown'); } }, }; }; //# sourceMappingURL=AngleInput.uni.driver.js.map