chore(nodes-edges): add data testids

This commit is contained in:
moklick
2022-09-14 13:08:57 +02:00
parent 3681b33b29
commit dea46511c3
3 changed files with 9 additions and 1 deletions
@@ -162,6 +162,7 @@ export default (EdgeComponent: ComponentType<EdgeProps>) => {
onKeyDown={disableKeyboardA11y ? undefined : onKeyDown}
tabIndex={disableKeyboardA11y ? undefined : 0}
role={disableKeyboardA11y ? undefined : 'button'}
data-testid={`rf__edge-${id}`}
aria-label={ariaLabel === null ? undefined : ariaLabel ? ariaLabel : `Edge from ${source} to ${target}`}
aria-describedby={disableKeyboardA11y ? undefined : `${ARIA_EDGE_DESC_KEY}-${rfId}`}
ref={edgeRef}
@@ -169,6 +169,7 @@ export default (NodeComponent: ComponentType<NodeProps>) => {
...style,
}}
data-id={id}
data-testid={`rf__node-${id}`}
onMouseEnter={onMouseEnterHandler}
onMouseMove={onMouseMoveHandler}
onMouseLeave={onMouseLeaveHandler}
@@ -163,7 +163,13 @@ const ReactFlow = forwardRef<ReactFlowRefType, ReactFlowProps>(
const rfId = useId();
return (
<div {...rest} style={{ ...style, ...wrapperStyle }} ref={ref} className={cc(['react-flow', className])}>
<div
{...rest}
style={{ ...style, ...wrapperStyle }}
ref={ref}
className={cc(['react-flow', className])}
data-testid="rf__wrapper"
>
<Wrapper>
<GraphView
onInit={onInit}