diff --git a/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.test.tsx b/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.test.tsx index 03d58374..6362992b 100644 --- a/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.test.tsx +++ b/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.test.tsx @@ -83,7 +83,7 @@ describe("Results Section component", () => { expect(resultsContent).toBeInTheDocument(); let applyBtn; await act(async () => { - applyBtn = await findByTestId(resultsContent, "select-action-0_apply"); + applyBtn = await findByTestId(resultsContent, "apply-code-0"); expect(applyBtn).toBeDefined(); userEvent.click(applyBtn); }); @@ -95,7 +95,7 @@ describe("Results Section component", () => { expect(resultsContent).toBeInTheDocument(); let applyBtn; await act(async () => { - applyBtn = await findByTestId(resultsContent, "select-action-0_apply"); + applyBtn = await findByTestId(resultsContent, "apply-code-0"); expect(applyBtn).toBeDefined(); userEvent.click(applyBtn); }); @@ -125,12 +125,6 @@ describe("Results Section component", () => { "DoNotDisturbOnIcon" ); - await waitFor(() => { - const selectButton = screen.getByTestId(`select-action-0_apply`); - expect(selectButton).toBeInTheDocument(); - userEvent.click(selectButton); - }); - const editButton = screen.getByTestId(`edit-code-0`); expect(editButton).toBeInTheDocument(); @@ -158,11 +152,7 @@ describe("Results Section component", () => { { ...mockCode, status: CodeStatus.NA }, "DoNotDisturbOnIcon" ); - await waitFor(() => { - const selectButton = screen.getByTestId(`select-action-0_apply`); - expect(selectButton).toBeInTheDocument(); - userEvent.click(selectButton); - }); + const editButton = screen.getByTestId(`edit-code-0`); userEvent.click(editButton); await waitFor(() => { diff --git a/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.tsx b/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.tsx index a9bbb102..b7c80cdf 100644 --- a/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.tsx +++ b/src/CqlBuilderPanel/codesSection/codesSubSection/codeSubSection/ResultsSection.tsx @@ -5,6 +5,8 @@ import CheckCircleIcon from "@mui/icons-material/CheckCircle"; import DoDisturbOutlinedIcon from "@mui/icons-material/DoDisturbOutlined"; import DoNotDisturbOnIcon from "@mui/icons-material/DoNotDisturbOn"; import ExpandingSection from "../../../../common/ExpandingSection"; +import ControlPointIcon from "@mui/icons-material/ControlPoint"; +import BorderColorOutlinedIcon from "@mui/icons-material/BorderColorOutlined"; import { useReactTable, @@ -15,7 +17,6 @@ import { import { Code, CodeStatus } from "../../../../api/useTerminologyServiceApi"; import ToolTippedIcon from "../../../../toolTippedIcon/ToolTippedIcon"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; -import { Popover } from "@madie/madie-design-system/dist/react"; import "./ResultsSection.scss"; import EditCodeDetailsDialog from "../common/EditCodeDetailsDialog"; @@ -41,9 +42,6 @@ export default function ResultsSection({ code, handleApplyCode, }: ResultSectionProps) { - const [optionsOpen, setOptionsOpen] = useState(false); - const [anchorEl, setAnchorEl] = useState(null); - const [selectedReferenceId, setSelectedReferenceId] = useState(null); const [selectedCodeDetails, setSelectedCodeDetails] = useState(null); const [openEditCodeDialog, setOpenEditCodeDialog] = useState(false); @@ -52,18 +50,9 @@ export default function ResultsSection({ selectedId, event: React.MouseEvent ) => { - setOptionsOpen(true); - setSelectedReferenceId(selectedId); - setAnchorEl(event.currentTarget); setSelectedCodeDetails(table.getRow(selectedId).original); }; - const handleClose = () => { - setOptionsOpen(false); - setSelectedReferenceId(null); - setAnchorEl(null); - }; - const data = [code]; const columns = useMemo[]>( () => [ @@ -91,19 +80,38 @@ export default function ResultsSection({ header: "", accessorKey: "apply", cell: (row: any) => ( -
- + +
), }, @@ -116,9 +124,8 @@ export default function ResultsSection({ columns, getCoreRowModel: getCoreRowModel(), }); - const handleApplyCodeInner = () => { - handleApplyCode(selectedCodeDetails); - setOptionsOpen(false); + const handleApplyCodeInner = (selectedCode) => { + handleApplyCode(selectedCode); }; const toggleEditCodeDialogState = () => { @@ -126,7 +133,6 @@ export default function ResultsSection({ }; const handleEditCode = () => { - setOptionsOpen(false); setOpenEditCodeDialog(true); }; @@ -207,24 +213,6 @@ export default function ResultsSection({ )) )} - handleApplyCodeInner(), - dataTestId: `apply-code-${selectedReferenceId}`, - }} - otherSelectOptionProps={[ - { - label: "Edit", - toImplementFunction: () => handleEditCode(), - dataTestId: `edit-code-${selectedReferenceId}`, - }, - ]} - /> { const editButton = getByTestId(`edit-code-0`); expect(editButton).toBeInTheDocument(); - const removeButton = getByTestId(`remove-code-0`); + const removeButton = getByTestId(`delete-code-0`); expect(removeButton).toBeInTheDocument(); userEvent.click(editButton); @@ -218,7 +218,7 @@ describe("Saved Codes section component", () => { const editButton = getByTestId(`edit-code-0`); expect(editButton).toBeInTheDocument(); - const removeButton = getByTestId(`remove-code-0`); + const removeButton = getByTestId(`delete-code-0`); expect(removeButton).toBeInTheDocument(); userEvent.click(removeButton); @@ -251,7 +251,7 @@ describe("Saved Codes section component", () => { ); await checkRows(2); - const removeButton = getByTestId(`remove-code-0`); + const removeButton = getByTestId(`delete-code-0`); expect(removeButton).toBeInTheDocument(); userEvent.click(removeButton); @@ -279,7 +279,7 @@ describe("Saved Codes section component", () => { ); await checkRows(2); - const removeButton = getByTestId(`remove-code-0`); + const removeButton = getByTestId(`delete-code-0`); expect(removeButton).toBeInTheDocument(); userEvent.click(removeButton); @@ -313,7 +313,7 @@ describe("Saved Codes section component", () => { ); await checkRows(2); - const removeButton = getByTestId(`remove-code-0`); + const removeButton = getByTestId(`delete-code-0`); expect(removeButton).toBeInTheDocument(); userEvent.click(removeButton); diff --git a/src/CqlBuilderPanel/codesSection/codesSubSection/savedCodesSubSection/SavedCodesSubSection.tsx b/src/CqlBuilderPanel/codesSection/codesSubSection/savedCodesSubSection/SavedCodesSubSection.tsx index 1d954530..64f99ec1 100644 --- a/src/CqlBuilderPanel/codesSection/codesSubSection/savedCodesSubSection/SavedCodesSubSection.tsx +++ b/src/CqlBuilderPanel/codesSection/codesSubSection/savedCodesSubSection/SavedCodesSubSection.tsx @@ -223,10 +223,10 @@ export default function SavedCodesSubSection({ {canEdit ? ( <> { setSelectedCodeDetails(