UNPKG

@wix/design-system

Version:

@wix/design-system

38 lines (37 loc) 1.57 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); exports.__esModule = true; exports.default = void 0; var _testUtils = _interopRequireDefault(require("react-dom/test-utils")); var _constants = require("./constants"); var sectionHelperDriverFactory = _ref => { var { element } = _ref; var hasSkin = skin => element.dataset.skin === skin; var byHook = hook => element.querySelector("[data-hook=\"".concat(hook, "\"]")); var getCloseButton = () => byHook('sectionhelper-close-btn'); var getActionButton = () => byHook('sectionhelper-action-btn'); return { exists: () => !!element, titleText: () => byHook('sectionhelper-title').textContent, actionText: () => getActionButton().textContent, clickAction: () => { _testUtils.default.Simulate.click(getActionButton()); }, clickClose: () => { _testUtils.default.Simulate.click(getCloseButton()); }, isCloseButtonDisplayed: () => !!getCloseButton(), textContent: () => element.textContent, isWarning: () => hasSkin(_constants.SKIN.Warning), isStandard: () => hasSkin(_constants.SKIN.Standard), isDanger: () => hasSkin(_constants.SKIN.Danger), isExperimentalDark: () => hasSkin(_constants.SKIN.ExperimentalDark), isSuccess: () => hasSkin(_constants.SKIN.Success), isPremium: () => hasSkin(_constants.SKIN.Premium), isPreview: () => hasSkin(_constants.SKIN.Preview) }; }; var _default = exports.default = sectionHelperDriverFactory; //# sourceMappingURL=SectionHelper.driver.js.map