UNPKG

wix-style-react

Version:
68 lines (61 loc) 1.98 kB
import { testkitFactoryCreator } from 'wix-ui-test-utils/vanilla'; import buttonDriverFactory from '../Backoffice/Button/Button.driver'; import styles from './styles.scss'; var buttonTestkitFactory = testkitFactoryCreator(buttonDriverFactory); var sectionHelperDriverFactory = function sectionHelperDriverFactory(_ref) { var element = _ref.element; var classExists = function classExists(className) { return element.classList.contains(className); }; var actionButtonDriver = function actionButtonDriver() { return buttonTestkitFactory({ wrapper: element, dataHook: 'sectionhelper-action-btn' }); }; var closeButtonDriver = function closeButtonDriver() { return buttonTestkitFactory({ wrapper: element, dataHook: 'sectionhelper-close-btn' }); }; return { exists: function exists() { return !!element; }, titleText: function titleText() { return element.querySelector('[data-hook="sectionhelper-title"]').textContent; }, actionText: function actionText() { return actionButtonDriver().getButtonTextContent(); }, clickAction: function clickAction() { return actionButtonDriver().click(); }, clickClose: function clickClose() { return closeButtonDriver().click(); }, isCloseButtonDisplayed: function isCloseButtonDisplayed() { return closeButtonDriver().exists(); }, textContent: function textContent() { return element.textContent; }, isWarning: function isWarning() { return classExists(styles.warning); }, isStandard: function isStandard() { return classExists(styles.standard); }, isDanger: function isDanger() { return classExists(styles.danger); }, isSuccess: function isSuccess() { return classExists(styles.success); }, isPremium: function isPremium() { return classExists(styles.premium); } }; }; export default sectionHelperDriverFactory;