@dtdot/lego 2.0.0-16 → 2.0.0-17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -23,7 +23,7 @@ export const Option = styled(motion.div) `
|
|
|
23
23
|
`;
|
|
24
24
|
export const SelectOptions = ({ options, onSelect }) => {
|
|
25
25
|
const theme = useTheme();
|
|
26
|
-
return (React.createElement(OptionsContainer, null, options.map((option) => (React.createElement(Option, { whileHover: { backgroundColor: theme.colours.controlBorder }, transition: { type: 'spring', duration: 0.2 }, key: option.value, onClick: () => onSelect(option.value) }, option.label)))));
|
|
26
|
+
return (React.createElement(OptionsContainer, null, options.map((option) => (React.createElement(Option, { "data-testid": `option-${option.value}`, whileHover: { backgroundColor: theme.colours.controlBorder }, transition: { type: 'spring', duration: 0.2 }, key: option.value, onClick: () => onSelect(option.value) }, option.label)))));
|
|
27
27
|
};
|
|
28
28
|
export const OptionsPopper = ({ referenceElement, options, onSelect, onClose }) => {
|
|
29
29
|
const [popperElement, setPopperElement] = useState();
|
|
@@ -39,6 +39,6 @@ export const OptionsPopper = ({ referenceElement, options, onSelect, onClose })
|
|
|
39
39
|
document.removeEventListener('mouseup', handleGlobalClick);
|
|
40
40
|
};
|
|
41
41
|
}, [handleGlobalClick, popperElement]);
|
|
42
|
-
return ReactDOM.createPortal(React.createElement("div", { ref: setPopperElement, style: { ...styles.popper, zIndex: 999, width: referenceElement?.offsetWidth }, ...attributes.popper },
|
|
42
|
+
return ReactDOM.createPortal(React.createElement("div", { "data-testid": 'options-popper', ref: setPopperElement, style: { ...styles.popper, zIndex: 999, width: referenceElement?.offsetWidth }, ...attributes.popper },
|
|
43
43
|
React.createElement(SelectOptions, { options: options, onSelect: onSelect })), document.querySelector('body'));
|
|
44
44
|
};
|