This repository has been archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Vinicius: Contra Frontend Assessment #94
Open
vi-hidden-alt
wants to merge
18
commits into
contra:main
Choose a base branch
from
vi-hidden-alt:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
vi-hidden-alt
commented
Apr 6, 2023
Comment on lines
+78
to
+92
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.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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