Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update and delete buttons of event modal are now working #1051

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/EventListCard/EventListCard.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@
justify-content: flex-end;
}
.icon {
transform: scale(1);
cursor: pointer;
color: #31bb6b;
margin: 1px;
}

.cards {
Expand Down Expand Up @@ -86,6 +84,8 @@
}
.dispflex {
display: flex;
margin-bottom: 5px;
margin-right: 5px;
}
.dispflex > input {
width: 20%;
Expand Down
41 changes: 37 additions & 4 deletions src/components/EventListCard/EventListCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,30 @@ describe('Testing Event List Card', () => {
expect(screen.queryByText(props.eventName)).not.toBeInTheDocument();
});

test('Testing for update modal', async () => {
render(
<MockedProvider addTypename={false} link={link}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<EventListCard {...props} />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);

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(
<MockedProvider addTypename={false} link={link}>
Expand All @@ -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'),
Expand Down Expand Up @@ -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'),
Expand Down Expand Up @@ -232,6 +258,11 @@ describe('Testing Event List Card', () => {
<EventListCard {...props} />
</MockedProvider>
);
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 () => {
Expand All @@ -240,7 +271,8 @@ describe('Testing Event List Card', () => {
<EventListCard {...props} />
</MockedProvider>
);

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('deleteEventModalBtn'));
const deleteBtn = screen.getByTestId('deleteEventBtn');
fireEvent.click(deleteBtn);
});
Expand All @@ -263,7 +295,8 @@ describe('Testing Event List Card', () => {
<EventListCard {...props} />
</MockedProvider>
);

userEvent.click(screen.getByTestId('card'));
userEvent.click(screen.getByTestId('deleteEventModalBtn'));
const deleteBtn = screen.getByTestId('deleteEventBtn');
fireEvent.click(deleteBtn);
});
Expand Down
Loading
Loading