Skip to content

Commit

Permalink
fix: Making sure email setting model opens when emailSettingsModal.op…
Browse files Browse the repository at this point in the history
…en is true
  • Loading branch information
zwidekalanga committed Jul 31, 2024
1 parent 01ceb41 commit 8c3a596
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const BaseCourseCard = ({

const handleEmailSettingsModalOnClose = (newValue) => {
resetModals();
if (hasEmailsEnabled !== undefined) {
if (newValue !== undefined) {
setHasEmailsEnabled(newValue);
}
};
Expand Down Expand Up @@ -345,6 +345,7 @@ const BaseCourseCard = ({
if (!hasEmailsEnabled) {
return null;
}

return (
<EmailSettingsModal
{...emailSettingsModal.options}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ describe('<BaseCourseCard />', () => {
it('handles email settings modal close/cancel', async () => {
userEvent.click(screen.getByTestId('modal-footer-btn', { name: 'Close' }));
await waitFor(() => {
expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
const dialogElement = screen.queryByRole('dialog');

if (dialogElement) {
expect(dialogElement).not.toHaveClass('show');
}
});
});
});
Expand Down

0 comments on commit 8c3a596

Please sign in to comment.