wix-style-react
Version:
wix-style-react
36 lines (32 loc) • 1.17 kB
JavaScript
import { mergeDrivers } from '../../../test/utils/private-drivers';
import { hasAttribute } from '../../../test/utils/protractor-helpers';
import focusableDriverFactory from '../../common/Focusable/Focusable.protractor.driver';
var buttonDriverFactory = function buttonDriverFactory(_element) {
var focusableDriver = focusableDriverFactory({
rootElement: _element,
nativeFocusableElement: _element,
clickableElements: [_element]
});
var publicDriver = {
click: function click() {
return _element.click();
},
getButtonTextContent: function getButtonTextContent() {
return _element.getText();
},
isButtonDisabled: function isButtonDisabled() {
return hasAttribute(_element, 'disabled');
},
isPrefixIconExists: function isPrefixIconExists() {
return _element.$('[data-hook="btn-prefix"]').isPresent();
},
isSuffixIconExists: function isSuffixIconExists() {
return _element.$('[data-hook="btn-suffix"]').isPresent();
},
element: function element() {
return _element;
}
};
return mergeDrivers(publicDriver, focusableDriver);
};
export default buttonDriverFactory;