diff --git a/src/components/EventListCard/EventListCard.module.css b/src/components/EventListCard/EventListCard.module.css
index 5b128d075d..3f6cb9aa27 100644
--- a/src/components/EventListCard/EventListCard.module.css
+++ b/src/components/EventListCard/EventListCard.module.css
@@ -26,9 +26,7 @@
justify-content: flex-end;
}
.icon {
- transform: scale(1);
- cursor: pointer;
- color: #31bb6b;
+ margin: 1px;
}
.cards {
diff --git a/src/components/EventListCard/EventListCard.test.tsx b/src/components/EventListCard/EventListCard.test.tsx
index ee48e2f871..17edaf5050 100644
--- a/src/components/EventListCard/EventListCard.test.tsx
+++ b/src/components/EventListCard/EventListCard.test.tsx
@@ -149,6 +149,30 @@ describe('Testing Event List Card', () => {
expect(screen.queryByText(props.eventName)).not.toBeInTheDocument();
});
+ test('Testing for update modal', async () => {
+ render(
+
+
+
+
+
+
+
+
+
+ );
+
+ await wait();
+
+ userEvent.click(screen.getByTestId('card'));
+ userEvent.click(screen.getByTestId('editEventModalBtn'));
+
+ userEvent.click(screen.getByTestId('EventUpdateModalCloseBtn'));
+ userEvent.click(screen.getByTestId('createEventModalCloseBtn'));
+
+ await wait();
+ });
+
test('Testing event update functionality', async () => {
render(
@@ -159,7 +183,8 @@ describe('Testing Event List Card', () => {
);
await wait();
-
+ userEvent.click(screen.getByTestId('card'));
+ userEvent.click(screen.getByTestId('editEventModalBtn'));
userEvent.type(screen.getByTestId('updateTitle'), props.eventName);
userEvent.type(
screen.getByTestId('updateDescription'),
@@ -199,7 +224,8 @@ describe('Testing Event List Card', () => {
);
await wait();
-
+ userEvent.click(screen.getByTestId('card'));
+ userEvent.click(screen.getByTestId('editEventModalBtn'));
userEvent.type(screen.getByTestId('updateTitle'), props.eventName);
userEvent.type(
screen.getByTestId('updateDescription'),
@@ -232,6 +258,11 @@ describe('Testing Event List Card', () => {
);
+ userEvent.click(screen.getByTestId('card'));
+ userEvent.click(screen.getByTestId('deleteEventModalBtn'));
+
+ userEvent.click(screen.getByTestId('EventDeleteModalCloseBtn'));
+ userEvent.click(screen.getByTestId('createEventModalCloseBtn'));
});
it('should call the delete event mutation when the "Yes" button is clicked', async () => {
@@ -240,7 +271,8 @@ describe('Testing Event List Card', () => {
);
-
+ userEvent.click(screen.getByTestId('card'));
+ userEvent.click(screen.getByTestId('deleteEventModalBtn'));
const deleteBtn = screen.getByTestId('deleteEventBtn');
fireEvent.click(deleteBtn);
});
@@ -263,7 +295,8 @@ describe('Testing Event List Card', () => {
);
-
+ userEvent.click(screen.getByTestId('card'));
+ userEvent.click(screen.getByTestId('deleteEventModalBtn'));
const deleteBtn = screen.getByTestId('deleteEventBtn');
fireEvent.click(deleteBtn);
});
diff --git a/src/components/EventListCard/EventListCard.tsx b/src/components/EventListCard/EventListCard.tsx
index 7f817890de..8053dfa828 100644
--- a/src/components/EventListCard/EventListCard.tsx
+++ b/src/components/EventListCard/EventListCard.tsx
@@ -38,6 +38,8 @@ function eventListCard(props: InterfaceEventListCardProps): JSX.Element {
const [recurringchecked, setRecurringChecked] = useState(false);
const [publicchecked, setPublicChecked] = useState(true);
const [registrablechecked, setRegistrableChecked] = React.useState(false);
+ const [eventDeleteisOpen, setEventDeleteModalIsOpen] = useState(false);
+ const [eventUpdateisOpen, setEventUpdateModalIsOpen] = useState(false);
const history = useHistory();
const [formState, setFormState] = useState({
title: '',
@@ -53,6 +55,20 @@ function eventListCard(props: InterfaceEventListCardProps): JSX.Element {
setEventModalIsOpen(false);
};
+ const showDeleteModal = (): void => {
+ setEventDeleteModalIsOpen(true);
+ };
+ const hideDeleteModal = (): void => {
+ setEventDeleteModalIsOpen(false);
+ };
+
+ const showUpdateModel = (): void => {
+ setEventUpdateModalIsOpen(true);
+ };
+ const hideUpdateModal = (): void => {
+ setEventUpdateModalIsOpen(false);
+ };
+
useEffect(() => {
setFormState({
title: props.eventName,
@@ -196,247 +212,225 @@ function eventListCard(props: InterfaceEventListCardProps): JSX.Element {
{/* delete modal */}
-
-
-
-
-
- {t('deleteEvent')}
-
-
-
-
{t('deleteEventMsg')}
-
-
-
-
-
-
-
+
+
+ {t('deleteEvent')}
+
+
+ {t('deleteEventMsg')}
+
+
+
+
+
{/* Edit Modal */}
-
-
-
-
-
- {t('editEvent')}
-
-
-
-
+
+
+
+
+
+
+
>
);
}