From 9147aecbd91507836a3dfd29864c32bad9cedc9b Mon Sep 17 00:00:00 2001 From: Ethan Kaplan Date: Mon, 16 Dec 2024 10:54:58 -0800 Subject: [PATCH] MAT-7935 test fixes --- package-lock.json | 2 +- package.json | 2 +- src/CqlBuilderPanel/CqlBuilderPanel.tsx | 2 +- .../definitionsSection/DefinitionsSection.test.tsx | 5 ++++- .../definitionBuilder/DefinitionBuilder.test.tsx | 11 +++++------ .../definitionsSection/definitions/Definitions.tsx | 8 ++++++-- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 227b548f..490eba8f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "version": "0.0.6", "dependencies": { "@madie/cql-antlr-parser": "^1.0.8", - "@madie/madie-design-system": "^1.2.37", + "@madie/madie-design-system": "^1.2.39", "@material-ui/core": "^4.12.4", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.73", diff --git a/package.json b/package.json index 61c9378d..b2ba8842 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ }, "dependencies": { "@madie/cql-antlr-parser": "^1.0.8", - "@madie/madie-design-system": "^1.2.37", + "@madie/madie-design-system": "^1.2.39", "@material-ui/core": "^4.12.4", "@mui/icons-material": "^5.5.1", "@mui/lab": "^5.0.0-alpha.73", diff --git a/src/CqlBuilderPanel/CqlBuilderPanel.tsx b/src/CqlBuilderPanel/CqlBuilderPanel.tsx index 0dcd2ce7..9c82fc26 100644 --- a/src/CqlBuilderPanel/CqlBuilderPanel.tsx +++ b/src/CqlBuilderPanel/CqlBuilderPanel.tsx @@ -240,7 +240,7 @@ export default function CqlBuilderPanel({ {activeTab === "definitions" && ( { userEvent.click(savedDefinitionsTab); const table = screen.getByRole("table"); expect(table).toBeInTheDocument(); - expect(screen.queryByTestId("definition-actions")).not.toBeInTheDocument(); + expect( + screen.queryAllByTestId("definition-actions")[0] + ).toBeInTheDocument(); + expect(screen.queryByTestId("view-button-0")).toBeInTheDocument(); }); it("Should render edit definition dialog on edit button click", async () => { diff --git a/src/CqlBuilderPanel/definitionsSection/definitionBuilder/DefinitionBuilder.test.tsx b/src/CqlBuilderPanel/definitionsSection/definitionBuilder/DefinitionBuilder.test.tsx index 0f1c9b34..ed6463a0 100644 --- a/src/CqlBuilderPanel/definitionsSection/definitionBuilder/DefinitionBuilder.test.tsx +++ b/src/CqlBuilderPanel/definitionsSection/definitionBuilder/DefinitionBuilder.test.tsx @@ -32,7 +32,7 @@ describe("CQL Definition Builder Tests", () => { expect(screen.queryByTestId("type-selector-input")).not.toBeInTheDocument(); }); - it("Should disable Apply button with canEdit being false", async () => { + it("Should hide Apply button with canEdit being false", async () => { render( { /> ); - const applyBtn = screen.getByTestId("definition-apply-btn"); - expect(applyBtn).toBeInTheDocument(); - expect(applyBtn).toBeDisabled(); + const applyBtn = screen.queryByTestId("definition-apply-btn"); + expect(applyBtn).not.toBeInTheDocument(); - const clearBtn = screen.getByTestId("clear-definition-btn"); + const clearBtn = screen.getByTestId("cancel-definition-btn"); expect(clearBtn).toBeInTheDocument(); - expect(clearBtn).toBeDisabled(); + expect(clearBtn).not.toBeDisabled(); }); it("Should open Expression Editor when definition name is entered", async () => { diff --git a/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx b/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx index 30b4e3b7..b1061aa9 100644 --- a/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx +++ b/src/CqlBuilderPanel/definitionsSection/definitions/Definitions.tsx @@ -140,8 +140,12 @@ const Definitions = ({ { showEditDefinitionDialog(row.cell.row.id);