-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2216 from flacial/2215-fix-cant-dismiss-an-alert
fix: Alert can't be dismissed
- Loading branch information
Showing
8 changed files
with
103 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import React from 'react' | ||
import { render, screen } from '@testing-library/react' | ||
import Alert from '.' | ||
import userEvent from '@testing-library/user-event' | ||
|
||
// Imported to be able to use .toBeInTheDocument() | ||
import '@testing-library/jest-dom' | ||
|
||
describe('Alert component', () => { | ||
it('should hide the alert on dismiss', async () => { | ||
render( | ||
<Alert | ||
alert={{ | ||
id: 0, | ||
text: 'Set up your computer to submit challenges.', | ||
type: 'info', | ||
url: 'https://www.notion.so/JS-0-Foundations-a43ca620e54945b2b620bcda5f3cf672#b45ed85a95e24c9d9fb784afb7a46bcc', | ||
urlCaption: 'View Instructions' | ||
}} | ||
onDismiss={() => {}} | ||
/> | ||
) | ||
|
||
await userEvent.click(screen.getByRole('button')) | ||
|
||
expect(screen.queryByRole('alert')).not.toBeInTheDocument() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
fcd0336
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
c0d3-app – ./
c0d3-app-c0d3-prod.vercel.app
v2.c0d3.app
c0d3-app.vercel.app
www.c0d3.com
c0d3-app-git-master-c0d3-prod.vercel.app