wix-style-react
Version:
wix-style-react
44 lines (39 loc) • 1.32 kB
JavaScript
import { StylableDOMUtil } from '@stylable/dom-test-kit';
import style from './Text.st.css';
import deprecationLog from '../utils/deprecationLog';
var textDriverFactory = function textDriverFactory(_ref) {
var element = _ref.element;
var stylableDOMUtil = new StylableDOMUtil(style);
return {
exists: function exists() {
return !!element;
},
getTagName: function getTagName() {
return element.tagName.toLowerCase();
},
getText: function getText() {
return element.innerHTML;
},
getSize: function getSize() {
return stylableDOMUtil.getStyleState(element, 'size');
},
getSkin: function getSkin() {
return stylableDOMUtil.getStyleState(element, 'skin');
},
getWeight: function getWeight() {
return stylableDOMUtil.getStyleState(element, 'weight');
},
isLight: function isLight() {
return stylableDOMUtil.hasStyleState(element, 'light');
},
isSecondary: function isSecondary() {
return stylableDOMUtil.hasStyleState(element, 'secondary');
},
// Deprecated
isBold: function isBold() {
deprecationLog('Text testkit method "isBold" is deprecated, use "getWeight" method instead');
return stylableDOMUtil.hasStyleState(element, 'bold');
}
};
};
export default textDriverFactory;