UNPKG

wix-style-react

Version:
27 lines (22 loc) 1.21 kB
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; import ReactTestUtils from 'react-dom/test-utils'; import { colorPickerDriverFactory as publicDriver } from './ColorPicker.driver'; export default (function (_ref) { var element = _ref.element; var hexInput = element && element.querySelector('[data-hook="color-picker-hex-input"] input'); return _extends({}, publicDriver({ element: element }), { selectBlackColor: function selectBlackColor() { // as with jsdom size of pallette 0 px, then click to 1,1 will make color black ReactTestUtils.Simulate.mouseDown(element.querySelector('[data-hook="color-picker-hsb"]'), { clientX: 1, clientY: 1 }); }, typeValueOnHexInput: function typeValueOnHexInput(value) { return ReactTestUtils.Simulate.change(hexInput, { target: { value: value } }); }, keyDownOnHexInput: function keyDownOnHexInput(key) { return ReactTestUtils.Simulate.keyDown(hexInput, { key: key }); } }); });