Skip to content

Commit c3a7aec

Browse files
committed
✨ (toolbar-button.tsx): add data-testid prop to ToolbarButton component for better testing capabilities
📝 (index.tsx): add data-testid attribute to various ToolbarButton components for better testability
1 parent 5d41fe5 commit c3a7aec

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/components/toolbar-button.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,22 @@ export const ToolbarButton = memo(
1313
label,
1414
shortcut,
1515
className,
16+
dataTestId,
1617
}: {
1718
onClick: () => void;
1819
icon: string;
1920
label?: string;
2021
shortcut?: any;
2122
className?: string;
23+
dataTestId?: string;
2224
}) => (
2325
<ShadTooltip content={<ShortcutDisplay {...shortcut} />} side="top">
2426
<Button
2527
className={cn("node-toolbar-buttons", className)}
2628
variant="ghost"
2729
onClick={onClick}
2830
size="node-toolbar"
31+
data-testid={dataTestId}
2932
>
3033
<ForwardedIconComponent name={icon} className="h-4 w-4" />
3134
{label && <span className="text-[13px] font-medium">{label}</span>}

src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ const NodeToolbarComponent = memo(
444444
shortcut={shortcuts.find((s) =>
445445
s.name.toLowerCase().startsWith("code"),
446446
)}
447+
dataTestId="code-button-modal"
447448
/>
448449
)}
449450
{nodeLength > 0 && (
@@ -454,6 +455,7 @@ const NodeToolbarComponent = memo(
454455
shortcut={shortcuts.find((s) =>
455456
s.name.toLowerCase().startsWith("advanced"),
456457
)}
458+
dataTestId="edit-button-modal"
457459
/>
458460
)}
459461
{!hasToolMode && (
@@ -471,6 +473,7 @@ const NodeToolbarComponent = memo(
471473
s.name.toLowerCase().startsWith("freeze path"),
472474
)}
473475
className={cn("node-toolbar-buttons", frozen && "text-blue-500")}
476+
dataTestId="freeze-path-button"
474477
/>
475478
)}
476479
{hasToolMode && (

0 commit comments

Comments
 (0)