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.
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
Frontend Tests, hooks and utils #437
Frontend Tests, hooks and utils #437
Changes from 61 commits
77602a6
979283b
57f531c
351e773
f448bf2
45ba199
e15f364
7d86bd3
f4234bb
509be7f
c266b7a
cdc36f8
b5352b9
ec19ac0
beaf354
082b71b
a9f66cb
63ff2ee
eb0ed8f
b78e6fb
6417aac
75d023a
7fcde98
935392e
b99bd8f
8fcc5f1
7026a0b
30ab241
9bd8fe6
9249f44
e3a30d9
c65c591
cd8852e
82a04d5
9394816
36286d1
f88a929
a3ac796
fd07355
0d8cf4a
863515e
754c8cf
293d4be
109568f
9020f70
da39c4f
838f695
6adb6d2
2e94714
aae1007
c0fbd05
07769d8
e64d303
40e3ac4
b0671a9
df06504
1fca00d
9d9d5bb
898b933
65874d3
5e10d51
9621ff3
194ab0b
43aec74
4f2fba8
9a63a2b
5f77ff9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
Large diffs are not rendered by default.
This file was deleted.
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.
I think we should use the
outsideElement
code here instead as the handler would only be called if the click was on an element outside the one hosting the hook.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.
Pushed through new changes, but I'm not 100% sure that my test is doing the right thing.
I changed this so that the event is dispatched to outerElement after unmounting the ref element hosting the hook, but for some reason it only works if I don't use
act()
. Keeping the bothunmount()
andoutsideElement.dispatchEvent(event)
inside theact()
scope caused the test to fail, removing act results in a failed test with the same assertion.I read the docs and this related post, but I'm still not 100% sure what is going on.
Am I actually testing the correct behavior this way?
@robert-w-gries
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.
AB - use RTL debug to check that all DOM elements are present. Can also get more specific with assertions to double check that correct behavior is being tested