-
Notifications
You must be signed in to change notification settings - Fork 44
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
Vinicius: Contra Frontend Assessment #94
base: main
Are you sure you want to change the base?
Conversation
it('closes on clicking outside the modal', async () => { | ||
expect.assertions(3); | ||
|
||
render(<ToggleableModal />); | ||
|
||
expect(screen.queryByText('Modal content')).not.toBeInTheDocument(); | ||
|
||
await userEvent.click(screen.getByText('Toggle modal')); | ||
|
||
expect(screen.getByText('Modal content')).toBeInTheDocument(); | ||
|
||
await userEvent.click(document.body); | ||
|
||
expect(screen.getByText('Modal content')).toBeInTheDocument(); | ||
}); |
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.
The last assertion in this test is incorrect - it's inverted. Looking back I assume the correct way wouldn't pass because I accidentally used document.addEventListener
instead of document.body.addEventListener
- and I'm clicking directly on document.body
in this test. Either way, I was out of time at the moment I realized it.
Hello there :)
This is my submission, featuring:
Went a little bit over time because I had to spend some time editing my Looms. Whoops.
Loom with a demo of the modal:
https://www.loom.com/share/6ef1439a4f5340798870207ff81a64a5
Loom with some of the code:
https://www.loom.com/share/d9c710a8f5f040b9a69fd2584d3d3671