wix-style-react
Version:
28 lines • 1.3 kB
JavaScript
import ReactTestUtils from 'react-dom/test-utils';
import { DataHooks } from './constants';
export var colorPickerDriverFactory = function colorPickerDriverFactory(_ref) {
var element = _ref.element;
return {
exists: function exists() {
return !!element;
},
confirm: function confirm() {
return ReactTestUtils.Simulate.click(element.querySelector("[data-hook=\"".concat(DataHooks.confirmButton, "\"]")));
},
cancel: function cancel() {
return ReactTestUtils.Simulate.click(element.querySelector("[data-hook=\"".concat(DataHooks.cancelButton, "\"]")));
},
clickOnPreviousColor: function clickOnPreviousColor() {
return ReactTestUtils.Simulate.click(element.querySelector("[data-hook=\"".concat(DataHooks.historyPrevious, "\"]")));
},
historyPanelExists: function historyPanelExists() {
return !!element.querySelector("[data-hook=\"".concat(DataHooks.history, "\"]"));
},
historyCurrentColor: function historyCurrentColor() {
return element.querySelector("[data-hook=\"".concat(DataHooks.historyCurrent, "\"]")).style.background;
},
historyPreviousColor: function historyPreviousColor() {
return element.querySelector("[data-hook=\"".concat(DataHooks.historyPrevious, "\"]")).style.background;
}
};
};