UNPKG

wix-style-react

Version:
49 lines (45 loc) 1.73 kB
import ReactTestUtils from 'react-dom/test-utils'; var messageBoxMarketerialLayoutDriverFactory = function messageBoxMarketerialLayoutDriverFactory(_ref) { var element = _ref.element; var primaryButton = function primaryButton() { return element.querySelector('[data-hook="primary-button"]'); }; var secondaryButton = function secondaryButton() { return element.querySelector('[data-hook="secondary-button"]'); }; var closeButton = function closeButton() { return element.querySelector('[data-hook="close-button"]'); }; return { exists: function exists() { return !!element; }, getPrimaryButtonText: function getPrimaryButtonText() { return primaryButton().textContent; }, getPrimaryButton: primaryButton, getSecondaryButtonText: function getSecondaryButtonText() { return secondaryButton().textContent; }, getSecondaryButton: secondaryButton, clickOnPrimaryButton: function clickOnPrimaryButton() { return ReactTestUtils.Simulate.click(primaryButton()); }, clickOnSecondaryButton: function clickOnSecondaryButton() { return ReactTestUtils.Simulate.click(secondaryButton()); }, closeMessageBox: function closeMessageBox() { return ReactTestUtils.Simulate.click(closeButton()); }, getTitle: function getTitle() { return element.querySelector('[data-hook="message-box-title"]').textContent; }, getContentBySelector: function getContentBySelector(selector) { return element.querySelector(selector); }, getImageSrc: function getImageSrc() { return element.querySelector('[data-hook="header-image"]').src; } }; }; export default messageBoxMarketerialLayoutDriverFactory;