From 4c80891b1c2edf1a22be5f0080778b2afe23736f Mon Sep 17 00:00:00 2001 From: Alex Golovanov Date: Tue, 4 Feb 2025 13:57:15 +0300 Subject: [PATCH] Restore data-testid attributes & update unit tests. --- .../ads/src/DismissibleTab/DismissibleTabBar.tsx | 1 + app/client/src/pages/Editor/IDE/EditorTabs/AddTab.tsx | 1 + app/client/src/pages/Editor/IDE/EditorTabs/EditableTab.tsx | 2 ++ .../src/pages/Editor/IDE/EditorTabs/Editortabs.test.tsx | 6 ++++-- app/client/src/pages/Editor/IDE/EditorTabs/index.tsx | 1 + 5 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx b/app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx index 2eeba0cb6f08..88ee35fe4a54 100644 --- a/app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx +++ b/app/client/packages/design-system/ads/src/DismissibleTab/DismissibleTabBar.tsx @@ -107,6 +107,7 @@ export const DismissibleTabBar = ({ ) : ( { // check tabs is empty const tabsContainer = getByTestId("t--tabs-container"); - expect(tabsContainer.firstChild).toBeNull(); + // tabs container contains 2 sentinel divs to check for intersections, so in empty state it should have 2 children + expect(tabsContainer.childElementCount).toBe(2); //check add button is not present expect(queryByTestId("t--ide-tabs-add-button")).toBeNull(); @@ -69,7 +70,8 @@ describe("EditorTabs render checks", () => { // check tabs is empty const tabsContainer = getByTestId("t--tabs-container"); - expect(tabsContainer.firstChild).toBeNull(); + // tabs container contains 2 sentinel divs to check for intersections, so in empty state it should have 2 children + expect(tabsContainer.childElementCount).toBe(2); //check add button is not present expect(queryByTestId("t--ide-tabs-add-button")).toBeNull(); diff --git a/app/client/src/pages/Editor/IDE/EditorTabs/index.tsx b/app/client/src/pages/Editor/IDE/EditorTabs/index.tsx index fdf4e21c55f9..b3c78c5b5c9d 100644 --- a/app/client/src/pages/Editor/IDE/EditorTabs/index.tsx +++ b/app/client/src/pages/Editor/IDE/EditorTabs/index.tsx @@ -93,6 +93,7 @@ const EditorTabs = () => { {showEntityListButton && (