Skip to content

Commit

Permalink
MAT-7935 test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ethankaplan committed Dec 16, 2024
1 parent 0a0eaa8 commit 9147aec
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/CqlBuilderPanel/CqlBuilderPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export default function CqlBuilderPanel({

{activeTab === "definitions" && (
<DefinitionsSection
canEdit={false}
canEdit={canEdit}
handleApplyDefinition={handleApplyDefinition}
handleDefinitionDelete={handleDefinitionDelete}
cqlBuilderLookupsTypes={cqlBuilderLookupsTypes}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ describe("DefinitionsSection", () => {
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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
<DefinitionBuilder
canEdit={false}
Expand All @@ -41,13 +41,12 @@ describe("CQL Definition Builder Tests", () => {
/>
);

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 () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,12 @@ const Definitions = ({
<ToolTippedIcon
tooltipMessage={canEdit ? "Edit" : "View"}
buttonProps={{
"data-testid": `edit-button-${row.cell.row.id}`,
"aria-label": `edit-button-${row.cell.row.id}`,
"data-testid": canEdit
? `edit-button-${row.cell.row.id}`
: `view-button-${row.cell.row.id}`,
"aria-label": canEdit
? `edit-button-${row.cell.row.id}`
: `view-button-${row.cell.row.id}`,
size: "small",
onClick: () => {
showEditDefinitionDialog(row.cell.row.id);
Expand Down

0 comments on commit 9147aec

Please sign in to comment.