wix-style-react
Version:
wix-style-react
37 lines (34 loc) • 1.11 kB
JavaScript
import { hasClass } from '../../test/utils/protractor-helpers';
import styles from './FormField.scss';
var fieldDriverFactory = function fieldDriverFactory(component) {
var byHook = function byHook(hook) {
return component.$('[data-hook*=' + hook + ']');
};
return {
element: function element() {
return component;
},
getLabel: function getLabel() {
return byHook('formfield-label');
},
hasTopLabel: function hasTopLabel() {
return hasClass(component, styles.labelFromTop);
},
hasRightLabel: function hasRightLabel() {
return hasClass(component, styles.labelFromRight);
},
hasLeftLabel: function hasLeftLabel() {
return hasClass(component, styles.labelFromLeft);
},
isRequired: function isRequired() {
return !!byHook('formfield-asterisk');
},
isInfoIconVisible: function isInfoIconVisible() {
return !!byHook('formfield-infoicon');
},
isContentStretched: function isContentStretched() {
return hasClass(component, styles.stretchContent);
}
};
};
export default fieldDriverFactory;