UNPKG

wix-style-react

Version:
42 lines 1.45 kB
import { baseUniDriverFactory, findByHook, findByHookAtIndex, } from '../test-utils/utils/unidriver'; import { DATA_HOOKS } from './constants'; export const rangeUniDriverFactory = (base, body) => { const label = () => findByHook(base, DATA_HOOKS.label); const input = () => findByHook(base, DATA_HOOKS.inputWrapper); const firstInput = () => findByHookAtIndex(base, DATA_HOOKS.inputElement, 0); const lastInput = () => findByHookAtIndex(base, DATA_HOOKS.inputElement, 1); return { ...baseUniDriverFactory(base, body), /** * Gets the input wrapper * @returns {Promise<HTMLElement>} */ getInput: () => input, /** * Clicks on the first input * @returns {Promise<void>} */ clickFirstInput: () => firstInput().click(), /** * Clicks on the last input * @returns {Promise<void>} */ clickLastInput: () => lastInput().click(), /** * Checks if both inputs exist * @returns {Promise<boolean>} */ hasInput: () => !!firstInput() && !!lastInput(), /** * Gets the label * @returns {Promise<HTMLElement>} */ getLabel: () => label, /** * Checks if label exists * @returns {Promise<boolean>} */ hasLabel: () => label().exists(), }; }; //# sourceMappingURL=Range.uni.driver.js.map