wix-style-react
Version:
wix-style-react
31 lines (27 loc) • 811 B
JavaScript
import ReactTestUtils from 'react-dom/test-utils';
var radioButtonDriverFactory = function radioButtonDriverFactory(_ref) {
var element = _ref.element;
var radioButton = element.childNodes[0];
var label = element.childNodes[1];
return {
exists: function exists() {
return !!element;
},
check: function check() {
return ReactTestUtils.Simulate.change(radioButton);
},
isChecked: function isChecked() {
return radioButton.checked;
},
isDisabled: function isDisabled() {
return radioButton.disabled;
},
getLabel: function getLabel() {
return label.textContent;
},
getContent: function getContent() {
return element.querySelector('[data-hook="radio-button-content"]');
}
};
};
export default radioButtonDriverFactory;