UNPKG

wix-style-react

Version:
24 lines 1.31 kB
import { baseUniDriverFactory, findByHook, ReactBase, } from '../../test-utils/utils/unidriver'; import { dataHooks } from './constants'; export const buttonCoreDriverFactory = (base) => { const reactBase = ReactBase(base); const getSuffix = () => findByHook(base, dataHooks.suffixIcon); const getPrefix = () => findByHook(base, dataHooks.prefixIcon); return { ...baseUniDriverFactory(base), getButtonTextContent: async () => base.text(), isButtonDisabled: async () => (await base.attr('aria-disabled')) === 'true', isDisabled: async () => (await base._prop('disabled')) === true, isFocused: async () => reactBase.isFocus(), isSuffixIconExists: async () => getSuffix().exists(), isPrefixIconExists: async () => getPrefix().exists(), focus: () => reactBase.focus(), getHref: async () => base.attr('href'), getTabIndex: async () => base.attr('tabIndex'), getTagName: async () => (await base._prop('tagName')).toLowerCase(), getType: async () => (await base._prop('type')).toLowerCase(), hasPrefixClass: async (className) => getPrefix().hasClass(className), hasSuffixClass: async (className) => getSuffix().hasClass(className), }; }; //# sourceMappingURL=ButtonCore.uni.driver.js.map