diff --git a/airflow/www/static/js/dag/details/graph/DagNode.test.tsx b/airflow/www/static/js/dag/details/graph/DagNode.test.tsx index 34ddac7506c71..7c6dea7584a0b 100644 --- a/airflow/www/static/js/dag/details/graph/DagNode.test.tsx +++ b/airflow/www/static/js/dag/details/graph/DagNode.test.tsx @@ -20,7 +20,7 @@ /* global describe, test, expect */ import React from "react"; -import { render } from "@testing-library/react"; +import { fireEvent, render } from "@testing-library/react"; import { Wrapper } from "src/utils/testUtils"; @@ -124,4 +124,16 @@ describe("Test Graph Node", () => { expect(getByTestId("node")).toHaveStyle("opacity: 0.3"); }); + + test("Clicks on taskName", async () => { + const { getByText } = render(, { + wrapper: Wrapper, + }); + + const taskName = getByText("task_id"); + + fireEvent.click(taskName); + + expect(taskName).toBeInTheDocument(); + }); }); diff --git a/airflow/www/static/js/dag/details/graph/DagNode.tsx b/airflow/www/static/js/dag/details/graph/DagNode.tsx index c2f9b01296c35..4ac1be8ef4ade 100644 --- a/airflow/www/static/js/dag/details/graph/DagNode.tsx +++ b/airflow/www/static/js/dag/details/graph/DagNode.tsx @@ -42,10 +42,10 @@ const DagNode = ({ task, isSelected, latestDagRunId, - onToggleCollapse, isOpen, isActive, setupTeardownType, + onToggleCollapse, labelStyle, style, isZoomedOut, @@ -139,8 +139,10 @@ const DagNode = ({ isOpen={isOpen} isGroup={!!childCount} onClick={(e) => { - e.stopPropagation(); - onToggleCollapse(); + if (childCount) { + e.stopPropagation(); + onToggleCollapse(); + } }} setupTeardownType={setupTeardownType} isZoomedOut={isZoomedOut}