UNPKG

wix-style-react

Version:
33 lines (29 loc) 1.19 kB
import _defineProperty from "@babel/runtime/helpers/defineProperty"; import { INTERNAL_DRIVER_SYMBOL } from '../../../test/utils/private-drivers'; import { hasAttribute, isFocused as _isFocused } from '../../../test/utils/protractor-helpers'; var focusableDriverFactory = function focusableDriverFactory(_ref) { var rootElement = _ref.rootElement, clickableElements = _ref.clickableElements, nativeFocusableElement = _ref.nativeFocusableElement; if (!rootElement || !clickableElements || !nativeFocusableElement) { throw new Error('focusableDriverFactory: Invalid arguments'); } return _defineProperty({ isFocused: function isFocused() { return _isFocused(nativeFocusableElement); } }, INTERNAL_DRIVER_SYMBOL, { rootElement: rootElement, hasFocusState: function hasFocusState() { return hasAttribute(rootElement, 'data-focus'); }, hasFocusVisibleState: function hasFocusVisibleState() { return hasAttribute(rootElement, 'data-focus-visible'); }, clickRoot: function clickRoot() { return rootElement.click(); }, clickableElements: clickableElements }); }; export default focusableDriverFactory;